Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 14155

ValueError: time data 'x' does not match format '%d-%m-%Y' (match) when using pd.to_datetime [duplicate]

$
0
0

Very simple question but I can't seem to find an answer. The date format in my CSV is in mm/dd/yyyy format specifically 1/16/1962 but i am trying to get it to change to a display of dd/mm/yyyy . But when i try to use pd.to_datetime... specifically

df.index = pd.to_datetime(df.index, format="%d-%m-%Y")

it says

ValueError: time data '1/16/1962' does not match format '%d-%m-%Y' (match)

I tried a number of ways including putting dayfirst = True into the bracket but it seems nothing works


Viewing all articles
Browse latest Browse all 14155

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>