import pandas as pd
df = pd.DataFrame({"y": [1,2,3]},
index=pd.to_datetime(["2000-03-31 00:00:00", "2000-05-31 00:00:00", "2000-08-31 00:00:00"]))
df.index = df.index.to_period("Q")
df
# y
#2000Q1 1
#2000Q2 2
#2000Q3 3