2

I did some pivoting and got column headers formatted as datetime objects, more precisely as periods, looking like this Period('2000Q1', 'Q-DEC'). Now how could I convert this period back into a string i.e. for the above just '2000Q1'?

realized this is a possible duplication of: Python/Pandas - Convert type from pandas period to string

Cheers

Fabian Bosler
  • 2,310
  • 2
  • 29
  • 49

1 Answers1

3

Just call str() on it

>> p = pd.Period('2001Q1')
>> str(p)
'2001Q1'
thaavik
  • 3,257
  • 2
  • 18
  • 25