0

I have a list of dates:

x = ['20200116, '20200117']

which i want to plot on x-axis. I used below code for formatting the list:

x = (datetime.datetime.strptime(date, '%Y%m%d').strftime('%m/%d/%Y') for date in x)

Expected output : a list with dates in '%m/%d/%Y' format but it returns an object. What am i doing wrong here?

0

1 Answer 1

1

Here x variable is a generator object, either use list(x) or [...] instead of (...).

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.