I have data that looks like this:data
I want to put this data into a dataframe but I get the following errors:
File "pandas/_libs/parsers.pyx", line 562, in pandas._libs.parsers.TextReader.__cinit__
File "pandas/_libs/parsers.pyx", line 790, in pandas._libs.parsers.TextReader._get_header
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
Here is my code:
Import necessary modules
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
sns.set()
# Import data into a dataframe
df = pd.read_csv("ETHData.csv")
df.head()
As suggested by some users I changed the df = pd.read_csv("ETHData.csv",encoding='latin1')
and received this output:
0 NaN
1 NaN
2 NaN
3 NaN
4 NaN
Update:
Simply copying and pasting the data from a .txt format to a .csv format solved the problem. Here is the correct output now:
DateTime Price [USD]
0 7/30/15 0:00 0.0
1 7/31/15 0:00 0.0
2 8/1/15 0:00 0.0
3 8/2/15 0:00 0.0
4 8/3/15 0:00 0.0