'Trying to match a pandas array to another so I can add them
I have the following program:
import pandas as pd
corr = []
first = 1995
last = 6726
for i in range(0, 6726):
corr.append([1.0*i])
corrPanda = pd.DataFrame(data=corr, columns=["Corr"])
index = pd.Index(range(first, first + last))
corrPanda = corrPanda.set_index(index)
print(corrPanda)
Its output is
1995 0.0
1996 1.0
1997 2.0
1998 3.0
1999 4.0
... ...
8716 6721.0
8717 6722.0
8718 6723.0
8719 6724.0
8720 6725.0
[6726 rows x 1 columns]
How can I have the array match another existing array which has an output listed below. I just want to add the two variables.
1995 6.902222
1996 6.903611
1997 6.905000
1998 6.907778
1999 6.910556
...
8716 26.991389
8717 26.993333
8718 26.994167
8719 26.995556
8720 26.996944
Name: Time, Length: 6726, dtype: float64
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
