基于枢轴表填充零值
我的数据集在Garageyrblt中缺少值,我想根据年制成。我该怎么做?
以下是基于年龄的Garageyrblt的枢轴表:
Garageyrblt
Pivot1年制造的 | 0 |
---|---|
1976 | 1 |
1970 | 2 |
1996 | 3 |
1996 3 | 1977 |
4 | 1977 4 1977 |
5 | 2006 |
6 | 1957 |
7 | 1957 7 1957 |
8 | 1965 |
9 | 1947, |
##### missing = df['GarageYrBlt'].isnull()
##### df_test.loc[missing,'GarageYrBlt'] = df_test.loc[missing,'YearBuilt'].apply(lambda x:pivot1[x])
但它说关键错误,我如何克服这一点?
My dataset has missing values in GarageYrBlt, which I would like to fill based on YearBuilt. How can I do it?
Below is pivot table for garageYrBlt based on yearblt:
pivot1
YearBuilt | GarageYrBlt |
---|---|
0 | 1976 |
1 | 1970 |
2 | 1996 |
3 | 1977 |
4 | 1977 |
5 | 2006 |
6 | 1957 |
7 | 1957 |
8 | 1965 |
9 | 1947 |
##### missing = df['GarageYrBlt'].isnull()
##### df_test.loc[missing,'GarageYrBlt'] = df_test.loc[missing,'YearBuilt'].apply(lambda x:pivot1[x])
but it says key error, how do I overcome this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论