0

I have created a DataFrame and want to populate its values across different columns in a different DataFrame.

Dataframe1 is something like:

Name Email              Telephone
Brad brad@gmail.com    302 923-9243
Igor igor@gmail.com    303 923-1093

And I want to populate an Excel file with columns like this:

E-mail   Favorite Food      Name        Games      Number

So I'd have to grab all that information from my dataset and populate it there

And I have this:

df_2['E-mail'] = df_1['E-mail']
df_2['Name'] = df_1['Name']
df_2['Telephone'] = df_1['Telephone']

But it's creating new columns.

How would I just add those rows to existing columns, and leaving blank the ones I have no data from?

Also, note that the telephone column name has changed to Number, and the Email has changed to E-mail, so I can't really merge them, I guess.

Peter Leimbigler
  • 10,775
  • 1
  • 23
  • 37
Chokitu
  • 57
  • 1
  • 7
  • *I want to paste it's values on different columns* The word *Paste* might not have been a good word choice. Since you are dealing with pandas dataframe, it's hard to understand what you mean by paste (maybe it's just me, though:)). – TheFaultInOurStars Apr 03 '22 at 00:54
  • I get where you are coming from, maybe populate? – Chokitu Apr 03 '22 at 01:20

0 Answers0