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 :: sparksession pyspark 
Python :: iterate over rows dataframe 
Python :: stop server django programmatically 
Python :: debug flask powershel 
Python :: json not readable python 
Python :: get request python 
Python :: swipe pyautogui 
Python :: how to count down in python using turtle graphics 
Python :: import file to colab 
Python :: how to make a url shortener in python 
Python :: python fiscal year prior 
Python :: how to order randomly in django orm 
Python :: python - sort dictionary by value 
Python :: password manager python with min and max pass lenght 
Python :: django sum get 0 if none 
Python :: program to calculate the volume of sphere python 
Python :: python httpserver 
Python :: how to read zip csv file in python 
Python :: how to move mouse for one place to another python using pyautogui 
Python :: jupyter no output cell 
Python :: python max absolute value 
Python :: python write yaml 
Python :: scipy stats arithmetic mean 
Python :: python magic windows error 
Python :: folium python map in full screen 
Python :: python requests pass auth token 
Python :: Join a list of items with different types as string in Python 
Python :: ellipsis in python as index 
Python :: how to remove trackback on python when ctrl c 
Python :: drop a column in pandas 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =