Seok-Jun Kim
Seok-Jun Kim

Reputation: 1

Having a trouble with table reading on pandas

I'm really new to programming and I've been trying to emulate the 'pandas.read_table' code from Python for Data Analysis book(the chapter on MovieLens 1M Data Set, pg.23ish). Below is the link to the file used for database and the images of jupyter notebook on which I've typed the codes. As you'll see there, I'm having a trouble with the data values not reading properly as it should, and I can't seem to figure out why. Your help will be much appreciated!

Trouble screen

Database file

Upvotes: 0

Views: 42

Answers (1)

victor
victor

Reputation: 1644

If you are reading data from a .csv file, use pd.read_csv.

If you want to use pd.read_table, you have to specify the delimiter as the comma with the argument sep=','. What is happening is that pd.read_table is trying to separate your input information at every ::, but it looks like your data is separated by commas instead.

More information here:

http://pandas.pydata.org/pandas-docs/stable/io.html

https://pandas.pydata.org/pandas-docs/stable/generated/pandas.read_table.html

Upvotes: 1

Related Questions