Reputation: 55
I have a .csv file that contains hundreds of rows and exactly 6 columns of data. However when reading the file in pandas and checking it afterwards, it seems there is only one column? I'm using Python 3.
data = pd.read_csv('filenamexy.csv')
data.info()
<class 'pandas.core.frame.DataFrame'>
MultiIndex: 52584 entries, (01.01.14 00;15, 15;15, 15;32, 43;15, 15;33) to
(31.12.19 23;;;;;, nan, nan, nan, nan)
Data columns (total 1 columns):
Date;DE;FR;NL;BE;CH 41611 non-null float64
dtypes: float64(1)
memory usage: 1.6+ MB
What am I missing here, pls?
*edit: first lines of filenamexy.csv:
Date;DE;FR;NL;BE;CH
01.01.14 00;15,15;15,15;32,43;15,15;33,27
01.01.14 01;12,96;12,96;32,49;12,96;30,07
01.01.14 02;12,09;12,09;28,43;12,09;23,01
01.01.14 03;11,70;11,70;27,63;11,70;11,04
01.01.14 04;11,66;11,66;25,99;11,66;9,09
01.01.14 05;11,35;11,35;24,47;11,35;11,44
Upvotes: 5
Views: 10998
Reputation: 2724
Use semicolon as your delimiter, when you read the csv:
pd.read_csv('filenamexy.csv', delimiter=';')
Upvotes: 9