I have Table in csv like below:
| date | col1 | |
|---|---|---|
| 1 | 01.04.2020 | 111 |
| 2 | 05.11.2019 | 2 |
| 3 | 22.05.2018 | 86 |
But when I try to read abowe csv in Python Pandas using below code:
df= pd.read_csv("my_data.csv")
I have Data Frame like below (it does not look good):
| ;date;col1 | |
|---|---|
| 0 | 1;01.04.2020;111 |
| 1 | 2;05.11.2019;2 |
| 2 | 3;22.05.2018;86 |
How can I modify my code to read this csv and as output have Data Frame in elegant form like in csv ?
>Solution :
It looks like your csv is using ; as a delimiter, instead of the default ,.
You might also wanna instruct pandas to use the first column as index.
Use df = pd.read_csv("my_data.csv", delimiter=';', index_col=0)