Home > other >  How to create columns in the same dataset Pandas?
How to create columns in the same dataset Pandas?

Time:05-24

I extract data from column using:

df_filtered = pd.DataFrame(df[1].apply(extractMMYY).tolist(), columns=['MM', 'YY'])

It returns me a new dataset, but I need to return MM, YY into initial dataset df.

I have tried:

df(df[1].apply(extractMMYY).tolist(), columns=['MM', 'YY'])

Or I need to bins two datasets to be able filter first df by df_filtered

CodePudding user response:

It looks to me like you are trying to do

df[['MM', 'YY']] = df[1].apply(extractMMYY).tolist()
  • Related