I am receiving the following warning:
UserWarning: Parsing dates in DD/MM/YYYY format when dayfirst=False (the default) was specified. This may lead to inconsistently parsed dates! Specify a format to ensure consistent parsing.
df = pd.read_csv(filename), parse_dates=['DateTime'], dayfirst=False)
My code:
df = pd.read_csv(filename, parse_dates=['DateTime'], dayfirst=False)
df['DateTime'] = df['DateTime'].apply(lambda x: datetime.strptime(str(x), '%Y-%m-%d %H:%M:%S').strftime('%d-%m-%Y'))
eod_quote = df.iloc[df.index[df['DateTime'].astype(str) == '{}'.format(current_date)].values.astype(int)[0]]['{}{}'.format(ticker,quote_asset)]
My csv contents when imported into panda DF:
UnixTimestamp DateTime ETHUSD
0 1649053626.0 04-04-2022 3521.58
1 ... ... ...
How do I change my code or the way I save or access the .csv
file to not receive the associated warning?
I have tried the following, but eod_quote
errors out, not able to find all the associated dates, and I believe this is how python is viewing the datetime format as the datetime and quote price exists within the .csv
file