Anwar San
Anwar San

Reputation: 81

Read CSV file in Pandas Python

I'm trying to read CSV file.

import pandas as pd
df = pd.read_csv(r'C:\Users\San\TEMP OLSTP MECH AMT.csv')
df.head()

But when I show the dataset, it looks messed up. enter image description here

contd. enter image description here

How to fix it? Is there any set up needed?

Upvotes: 0

Views: 841

Answers (2)

Daweo
Daweo

Reputation: 36360

Your data is ;-sheared, you need to inform pandas about that, try

import pandas as pd
df = pd.read_csv(r'C:\Users\San\TEMP OLSTP MECH AMT.csv',sep=";")
df.head()

Read pandas.read_csv docs if you want to know more

Upvotes: 4

Himanshu
Himanshu

Reputation: 3970

Try this

  import pandas as pd
 df = pd.read_csv(r'C:\Users\San\TEMP OLSTP MECH 
           AMT.csv', sep=';' ) 
  df.head()

 

Upvotes: 1

Related Questions