Since pd.Period can analyze quarterly periods, you can use it as a custom date_parser . Then, to convert the date to the last day of the quarter, you can use the map attribute and end_time :
import pandas as pd text = '''\ date val 2013Q2 100 2013Q3 120 ''' filename = '/tmp/data' with open(filename, 'w') as f: f.write(text) df = pd.read_table(filename, sep='\s+', date_parser=pd.Period, parse_dates=[0]) df['date'] = df['date'].map(lambda x: x.end_time.date()) print(df)
unutbu
source share