How to append new data in pandas DataFrame

0 votes

Hi Guys,

I have one Pandas DataFrame. I want to append new data in this DataFrame. Can anyone tell me how can I do this?

Jun 23, 2020 in Python by MD
• 95,440 points
491 views

1 answer to this question.

0 votes

Hi@MD,

You can use the append function to add new data in your DataFrame. You can go through the below example.

df1 = pd.DataFrame({"x":[25,15,12,19],"y":[47, 24, 17, 29]}) 
df2 = pd.DataFrame({"x":[25, 15, 12],"y":[47, 24, 17],"z":[38, 12, 45]}) 
df1.append(df2, ignore_index = True)   
x y z
0 25 47 NaN
1 15 24 NaN
2 12 17 NaN
3 19 29 NaN
4 25 47 38.0
5 15 24 12.0
6 12 17 45.0

I hope this will help you.

answered Jun 23, 2020 by akhtar
• 38,230 points

Related Questions In Python

0 votes
1 answer

How to change data types in Pandas DataFrame?

Hi@akhtar, You can use astype function to change ...READ MORE

answered Jun 23, 2020 in Python by MD
• 95,440 points
892 views
0 votes
1 answer

How to replace values with None in Pandas data frame in Python?

Actually in later versions of pandas this ...READ MORE

answered Aug 30, 2018 in Python by Priyaj
• 58,090 points
11,182 views
0 votes
1 answer

How to convert a Pandas GroupBy object to DataFrame in Python

g1 here is a DataFrame. It has a hierarchical index, ...READ MORE

answered Nov 12, 2018 in Python by Nymeria
• 3,560 points
34,084 views
0 votes
1 answer

How to find an element in Pandas Dataframe?

You can do it like this: Suppose df is ...READ MORE

answered Apr 8, 2019 in Python by Tina
72,970 views
0 votes
1 answer

How to find if a value exists in Pandas dataframe?

Try this:​ for name in df['Name']: ...READ MORE

answered Apr 8, 2019 in Python by Tina
12,300 views
0 votes
1 answer
0 votes
1 answer

How to create Pandas series from dictionary?

Here's a sample script: import pandas as pd import ...READ MORE

answered Apr 1, 2019 in Python by Prateek
2,128 views
0 votes
1 answer

How to create Pandas series from numpy array?

Hi. Refer to the below command: import pandas ...READ MORE

answered Apr 1, 2019 in Python by Pavan
3,247 views
0 votes
2 answers
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP