Draft version
Below you can see a simple example of how to use the pd.concat() method to add new rows to a DataFrame
import numpy as np
import pandas as pd
data1 = {'country': ['Italy','Spain','Greece','France','Portugal'],
'popu': [61, 46, 11, 65, 10]
}
data2 = {'country': ['Brazil','Argentina'],
'popu': [207, 44]
}
df1 = pd.DataFrame(data1, index=['ITA', 'ESP', 'GRC', 'FRA', 'PRT'])
print(df1,'\n')
df2 = pd.DataFrame(data2, index=['BRA', 'ARG'])
print(df2)
total = pd.concat([df2, df1])
total
. Free learning material
. See full copyright and disclaimer notice