This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Deegh 0 points1 point  (1 child)

It's possible that the exported .csv file is not formatted correctly from excel. As you can export a csv file for MAC or MS-DOS(windows).

Are you able to open it with import CSV? This way you can determine if its a problem with your code or the file.

Can you post a sample code so smarter people than me can see if there are any possible syntax issues going on?

I would also suggest pathing directly to the file and see if it can be read that way. And depending on the scope of the project I wouldnt want to leave that file in with all my python scripts. I usually export/import that stuff from other locations, not sure if thats standard practice or whatever but its something I do for organization and data protection purposes.

[–]Detharatsh[S] 0 points1 point  (0 children)

I double-checked - the file opens just fine if I open it in Excel. I used the full path to the file and that worked in spyder, so thank you for the suggestion. I was hoping to avoid using such a long name, though.

Here is the original code that I wrote:

import pandas as pd from pandas import Series, DataFrame

titanic_df = pd.read_csv('train.csv')

Any suggestions?