Home > OS >  Why pandas read csv returns raw data instead of dataframe
Why pandas read csv returns raw data instead of dataframe

Time:06-20

enter image description hereI am trying to read the Advertising.csv in pandas. The output I get is raw data shrunk into one column with commas separating the values:

,TV,radio,newspaper,sales
0   1,230.1,37.8,69.2,22.1
1   2,44.5,39.3,45.1,10.4
2   3,17.2,45.9,69.3,9.3
3   4,151.5,41.3,58.5,18.5
4   5,180.8,10.8,58.4,12.9

I tried different parameters but had no luck.

df = pd.read_csv(file_path, "Advertising.csv")

I appreciate any help you can provide.

CodePudding user response:

Try:

df = pd.read_csv(file_path , sep=',')
  • Related