累积列数据框

cumulative column dataframe

df['Volume cummulated'] = df['Positive_Negative_Volume'].cumsum()

我无法在右栏中得到正确的累计和

我不认为这有助于解决你的问题,但看看这个-

import pandas as pd

values = [5643397.6053299,
          3496291.56664438,
          -5480337.35603218,
          12944037.55061038,
          6574092.80269061,
          -5331202.45221019,
          -4508747.90607631,
          5609366.20613776,
          4719385.57010436,
          -4840785.79801116,
          4149434.68258942,
          -6587934.91085111,
          12442827.1189019]
df = pd.DataFrame(data={'values': values})
print(df['values'].cumsum().values)
输出
[ 5643397.6053299   9139689.17197428  3659351.8159421  16603389.36655248
 23177482.16924309 17846279.7170329  13337531.81095659 18946898.01709435
 23666283.58719871 18825497.78918755 22974932.47177697 16386997.56092586
 28829824.67982776]

我建议你 运行 df.dtypesdf.describe(),它可以帮助 pin-point 解决问题