I have the following code to import from a CSV file
data = pd.read_csv(("dados_meteo.csv"),\
names=['POM','DTM','RNF','WET','HMD','TMP','DEW','INF'],\
parse_dates = ['DTM'])
then
data.dtypes
returns
POM object
DTM object
RNF float64
WET float64
HMD float64
TMP float64
DEW float64
INF int64
dtype: object
After using
data['DTM'] = data['DTM'].astype('datetime64[ns]')
The DTM keeps the same type. Could you help me?
Thank you
Check your CSV file date column and make sure it is set to as date type ( or else select column=> right click =>Format cells=>Under category select Date=>and select date format)
then
data =pd.read_csv("dados_meteo.csv",parse_dates=['date-coumn-name-here'])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With