将行的所有元素转换为月份和年份的名称

Convert all elements of row to name of month and year

我想将第 4 行(索引 3)转换为年月名称

我有一个数据框,其中一行包含日期。它是 datetime.datetime 对象。我想将行的所有元素转换为月份和年份的名称。

Select 行,操作它来提取年月名称,并替换:

datetime = pd.to_datetime(df.iloc[3])
month_year = datetime.apply(lambda x: x.month_name() + ", " + str(x.year))
df.iloc[3] = month_year