'Python- How to Combine 2 pandas.core.frame =.dataframe with the same column name together in python [duplicate]
So i got 2 pandas.core.frame.DataFrame like this:
anomalies:
Sales outlet
Date
2006-07-01 700 2
and this (anomalies2):
Sales outlet
Date
2011-03-01 206 1
2012-03-01 900 1
i tried combining them using :
anomalies3 = []
anomalies3.append(anomalies)
anomalies3.append(anomalies2)
print(anomalies3)
but the result are like this:
[ Sales outlet
Date
2006-07-01 700 2, Sales outlet
Date
2011-03-01 206 1
2012-03-01 900 1]
how do i make it so the result were like
[ Sales outlet
Date
2006-07-01 700 2
2011-03-01 206 1
2012-03-01 900 1]
Thanks in advance! and remember both are pandas.core.frame.DataFrame (type(anomalies) and type(anomalies2) give back pandas.core.frame.DataFrame)
Solution 1:[1]
just use
anomalies3 = pd.concat([anomalies, anomalies2])
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Srome |
