Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

append dataframe to another dataframe

>>> df = pd.DataFrame([[1, 2], [3, 4]], columns=list('AB'), index=['x', 'y'])
>>> df
   A  B
x  1  2
y  3  4
>>> df2 = pd.DataFrame([[5, 6], [7, 8]], columns=list('AB'), index=['x', 'y'])
>>> df.append(df2, ignore_index=True)
   A  B
x  1  2
y  3  4
x  5  6
y  7  8
Comment

pandas add one df to another

# stacks n dataframes on top of one another
df = pd.concat([df1, df2, ..., dfn], ignore_index=True)
Comment

how to append a dataframe to another dataframe in pandas

# all_res is list of DataFrames : [ dataframe, dataframe, ... ]
df_res = pd.concat(all_res)
Comment

PREVIOUS NEXT
Code Example
Python :: Exception Value: Object of type User is not JSON serializable 
Python :: get last 3 things in a list python 
Python :: python last n list elements 
Python :: kubernetes python client 
Python :: append object python 
Python :: access list items in python 
Python :: discord.py get server id 
Python :: round list python 
Python :: boto3.resource python 
Python :: array of numbers 
Python :: python pillow convert jpg to png 
Python :: sort folders content by name python 
Python :: find max in a dataframe 
Python :: prevent division by zero numpy 
Python :: int to alphabet letter python 
Python :: feature selection python 
Python :: extract name of file from path python 
Python :: Program for length of the shortest word 
Python :: append data at the end of an excel sheet pandas 
Python :: delete cell in jupyter notebook 
Python :: check for double character in a string python 
Python :: convert xls to xlsx python 
Python :: numpy array sorting 
Python :: unique combinations in python 
Python :: rps python 
Python :: memory usage in python 
Python :: flask print request headers 
Python :: unsigned int python 
Python :: make sns heatmap colorbar larger 
Python :: random.sample python 
ADD CONTENT
Topic
Content
Source link
Name
1+7 =