Jan-06-2020, 06:30 AM
If we doesn't define ignore_index parameter, the concat/append will add second dataframe rows with the original index numbers it had, thus the new added rows have same index again which start with 0.
Sandeep
GANGA SANDEEP KUMAR
import pandas as pd foo = pd.concat([pd.DataFrame({'foo': [10,20]}), pd.DataFrame({'foo': [30,40]})],ignore_index=True) bar = pd.DataFrame({'bar': [1, 2, 3, 4]}) foo["bar"] = bar["bar"] print((foo["bar"].values == bar["bar"].values).all()) print(foo)
Output:True
foo bar
0 10 1
1 20 2
2 30 3
3 40 4
Best Regards,Sandeep
GANGA SANDEEP KUMAR