Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to create columns in the same dataset Pandas?

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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

>Solution :

It looks to me like you are trying to do

df[['MM', 'YY']] = df[1].apply(extractMMYY).tolist()
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading