Python Forum
Can't read text file with pandas
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can't read text file with pandas
#4
Pandas isn't set up for that sort of thing, because you can't have a different number of columns in different rows of a dataframe. Perhaps someone more familiar with pandas.read_csv can correct me, but I don't see a way to assume extra columns and fill them with dummy values. Therefore you would need to see skiprows and nrows (see the pandas.read_csv docs) to load different sections of the file into different dataframes. If you need them to be one dataframe, you can combine them after they are loaded.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
Can't read text file with pandas - by zinho - May-23-2019, 12:43 PM
RE: Can't read text file with pandas - by zinho - May-23-2019, 02:37 PM
RE: Can't read text file with pandas - by ichabod801 - May-23-2019, 03:04 PM
RE: Can't read text file with pandas - by zinho - May-23-2019, 05:31 PM
RE: Can't read text file with pandas - by zinho - May-15-2020, 02:23 PM
RE: Can't read text file with pandas - by azajali43 - May-24-2020, 06:13 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Pandas read csv file in 'date/time' chunks MorganSamage 4 1,725 Feb-13-2023, 11:24 AM
Last Post: MorganSamage
Smile How to further boost the data read write speed using pandas tjk9501 1 1,276 Nov-14-2022, 01:46 PM
Last Post: jefsummers
  How to import an xml file to Pandas sjhazard 0 2,371 Jun-08-2021, 08:19 PM
Last Post: sjhazard
  Read json array data by pandas vipinct 0 1,962 Apr-13-2020, 02:24 PM
Last Post: vipinct
  Can python read Marathi text files and summarize them? mcp111 0 1,844 Mar-18-2020, 08:58 AM
Last Post: mcp111
  Read file Into array with just $0d as Newline lastyle 5 3,403 Feb-03-2020, 11:58 PM
Last Post: lastyle
  getting trailing zeros with 1 during pandas read fullstop 1 3,624 Jan-05-2020, 04:01 PM
Last Post: ichabod801
  Read csv file from Yahoo Finance ian 3 4,680 Sep-22-2019, 06:47 AM
Last Post: ndc85430
  Read Text From Image Nitesh 0 15,075 Jul-25-2019, 02:35 PM
Last Post: Nitesh
  Read Nested JSON with pandas.io.json palo173 4 9,609 Apr-29-2019, 01:25 PM
Last Post: palo173

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020