How to connect and append with Pandas DataFrame
This article mainly introduces how to connect and append Pandas DataFrame. It is very detailed and has a certain reference value. Friends who are interested must finish reading it.
Getting started exampl
Code snippet:
# connection and additional data of Dataframe # In [23]: import pandas as pd# In [24]: df1 = pd.DataFrame ({'num': [60, 20, 80, 90],' rate':, 'value': [40, 50, 50, 55]}, index= [2001, 2002, 2003, 2004]) # In [25]: df2 = pd.DataFrame ({' num': [60, 20, 80, 90]) Rate':, value':, index=, In: df3 = pd.DataFrame ({'num':, 20,8090, rate':, kpi':), kpi': Index= [2001, 2002, 2003, 2004]) # using pd.concat () to connect multiple DataFrame# In [27]: concat_df = pd.concat ([df1,df2]) concat_df# connect three dataframe# In [28]: concat_df_all = pd.concat ([df1,df2,df3]) Sort=False) concat_df_all# append dataframe# In using append (): df4 = df1.append (df2) df4# In [30]: df5 = df1.append (df3,sort=False) df5# append Series# In [31]: s = pd.Series ([77 num','rate','value']) # In [32]: df6 = df1.append (s) Ignore_index=True) df6 above is all the content of the article "how to connect and append Pandas DataFrame" Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!