Reputation: 87
I have a CSV.file which looks just fine. Please see the picture below:
However, when I open the file in Jupyter Notebook, the columns are concanated. Please see below:
I used the following code to open the file:
import pandas as pd
MSCI = pd.read_csv("/Users/user/data/MSCI Wolrd returns.csv", header=0, index_col=0, parse_dates=True)
MSCI.head()
How could I go about fixing this problem? How can I open the file so that the dates will be in one column and the values in the other?
Upvotes: 0
Views: 779
Reputation: 1365
Its because, in your data seperator
is ;
and pandas use default
comma ,
as seperator.
Try this
import pandas as pd
MSCI = pd.read_csv("/Users/user/data/MSCI Wolrd returns.csv", header=0, index_col=0, parse_dates=True,sep=";")
MSCI.head()
If this solution is answer to your question then accept it else comment whats the problem.
Upvotes: 1