Excel not formatting dates on csv file

40 views Asked by At

I have been trying to perform data analysis on gold and usd data from Yahoo and the dates simply won't format I've tried everything from datevalue to TEXT(...,yyyy-mm-dd) nothing seems to be helping even chat gpt is useless here any help ill appreciate

I tried the datevalue formula which only brings up the *Value! Answer as well as the TEXT formula even trying to edit the cells either with text to columns or assigning the date values I want to the cell but the date remains unchanged

1

There are 1 answers

1
ProProgramer On

Well, first import pandas:

import pandas as pd

Then read the .csv file:

df = pd.read_csv('filename.csv')

Convert it to datetime with pd.to_datetime():

data['write here'] = pd.to_datetime(data['write here'])

And then make a new column as formatted_date:

df['Formatted_Date'] = df['write here'].dt.strftime('%Y-%m-%d')

Good luck!