I have a problem converting a dtype column. I am downloading a csv file from yahoo finance.
dt = pd.read_csv('data/Tesla.csv')
this gives me the following information:
<class 'pandas.core.frame.DataFrame'>
Int64Index: 923 entries, 0 to 922
Data columns (total 7 columns):
Date 923 non-null object
Open 923 non-null float64
High 923 non-null float64
Low 923 non-null float64
Close 923 non-null float64
Volume 923 non-null int64
Adj Close 923 non-null float64
dtypes: float64(5), int64(1), object(1)
I am trying to convert Date to a string, but everything I'm trying to do does not work. I tried iterating over a string and converting it with str (). I tried changing the dtype of an object using dt['Date'].apply(str), and I tried a special dtype object and used it:
types={'Date':'str','Open':'float','High':'float','Low':'float','Close':'float','Volume':'int','Adj Close':'float'}
dt = pd.read_csv('data/Tesla.csv', dtype=types)
But nothing works.
I am using pandas version 0.13.1
source
share