【发布时间】:2022-01-11 13:30:32
【问题描述】:
我在我的 python 3.X 中使用 Pandas 0.20.3。我想在另一个熊猫数据框中的熊猫数据框中添加一列。两个数据框都包含 51 行。所以我使用了以下代码:
class_df['phone']=group['phone'].values
我收到以下错误消息:
ValueError: Cannot set a frame with no defined index and a value that cannot be converted to a Series
class_df.dtypes 给我:
Group_ID object
YEAR object
Terget object
phone object
age object
而type(group['phone']) 返回pandas.core.series.Series
您能否建议我需要做哪些更改才能消除此错误?
group['phone']的前5行如下:
0 [735015372, 72151508105, 7217511580, 721150431...
1 []
2 [735152771, 7351515043, 7115380870, 7115427...
3 [7111332015, 73140214, 737443075, 7110815115...
4 [718218718, 718221342, 73551401, 71811507...
Name: phoen, dtype: object
【问题讨论】:
标签: python