回答此问题可获得 20 贡献值,回答如果被采纳可获得 50 分。
<p>我需要数据帧,我用的是熊猫。
我想从一个可变日期到一列中的值做一个累计和</p>
<p>我想在df2中添加第二列来显示日期,以便知道df2中date2之后AVG列的和大于100的日期。在</p>
<p>例如,df1和df2是我开始的数据帧,df3是我想要的,df3['date100']是平均值总和大于100的那一天:</p>
<pre><code>df1 = pd.DataFrame({'date1': ['1/1/2014', '2/1/2014', '3/1/2014','1/1/2014', '2/1/2014', '3/1/2014','1/1/2014', '2/1/2014', '3/1/2014'],
'Place':['A','A','A','B','B','B','C','C','C'],'AVG': [62,14,47,25,74,60,78,27,41]})
df2 = pd.DataFrame({'date2': ['1/1/2014', '2/1/2014'], 'Place':['A','C'])})
*Something*
df3 = pd.DataFrame({'date2': ['1/1/2014', '2/1/2014'], 'Place':['A','C'], 'date100': ['3/1/2014', '2/1/2014'], 'sum': [123, 105]})
</code></pre>
<p>我找到了一些答案,但大多数都使用groupby,而df2没有分组。在</p>