[Tutor] Pandas help

Alan Gauld alan.gauld at yahoo.co.uk
Sun Sep 13 08:26:40 EDT 2020


On 13/09/2020 10:14, nzbz xx wrote:
> I am trying to convert the date column index into datetime in mmm-yy
> format. This is what I've tried however there's an error which says "time
> data '31/12/2019' does not match format '%b %Y' (match)". How do I go about
> this?
> 
> [image: image.png]

As you can see the server strips out binary attachments.
Please cut n paste your code plus any error messages in
full into the body of your mail(using plain text format).

However, based on your message above, it would seem you are using a
format string that only expects the month and year but you are
passing a date in day/month/year format. For "%b %Y" to work
your date string would need to look like "Sep 2020"

To match your date you would need a format string like "%d/%m/%Y"

HTH
-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list