У меня есть 2 кадра данных, сгенерированных как
df_atn5_agg = df_atn5.groupby(['pipeline_name'], as_index=False).agg({'tot_map_comp_mins':['count', p25]})
df2_t1 = df_atn5_agg[df_atn5_agg['tot_map_comp_mins']['count'] > 1]
df_prod_agg = df_prod.groupby(['pipeline_name'], as_index=False).agg({'tot_map_comp_mins':['count', p25]})
df3_prod = df_prod_agg[df_prod_agg['tot_map_comp_mins']['count'] > 1]
Я хотел добавить новый столбец к
df2_t1['exchange_ratio'] = (
(df2_t1['tot_map_comp_mins']['p25']* 1.0) /
(
df_prod_agg[df2_t1['pipeline_name'] == df_prod_agg['pipeline_name']]['tot_map_comp_mins']['p25']
)
)
И я получил это
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-298-ddbc217187e3> in <module>
1 df2_t1['exchange_ratio'] = ((df2_t1['tot_map_comp_mins']['p25']* 1.0) /
2 (
----> 3 df_prod_agg[df2_t1['pipeline_name'] == df_prod_agg['pipeline_name']]
4 ['tot_map_comp_mins']['p25']
5 )
/mnt/xarfuse/uid-115541/4cee94fa-ns-4026531840/pandas/core/ops/common.py in new_method(self, other)
62 other = item_from_zerodim(other)
63
---> 64 return method(self, other)
65
66 return new_method
/mnt/xarfuse/uid-115541/4cee94fa-ns-4026531840/pandas/core/ops/__init__.py in wrapper(self, other)
519
520 if isinstance(other, ABCSeries) and not self._indexed_same(other):
--> 521 raise ValueError("Can only compare identically-labeled Series objects")
522
523 lvalues = extract_array(self, extract_numpy=True)
ValueError: Can only compare identically-labeled Series objects
В основном я хочу получить доступ к ['tot_map_comp_mins']['p25']
из df_prod_agg
строки, где df2_t1['pipeline_name'] == df_prod_agg['pipeline_name']
Любая помощь очень ценится.