我试图删除“建造年份”列中值小于 1920 的所有行。我不明白如何转换为整数,因此我可以评估 1920 年以内的建成条件,然后删除 1920 年之前建造的那些建筑物。任何方向都值得赞赏!
没有错误:
YearBuilt_convert_to_integer = dframe[13].astype(int)
没有错误:
YearBuilt_less_than_1920 = YearBuilt_convert_to_integer < 1920
输出:
YearBuilt_less_than_1920
42 False
43 False
44 False
45 True
46 False
...
3533 False
3534 False
3535 False
3536 False
3537 False
Name: 13, Length: 3347, dtype: bool
产生 0 行:
dframe = dframe.loc[~dframe[13].astype(int)<1920, :]
0 1 2 3 4 5 6 7 8 9 ... 32 33 34 35 36 37 38 39 40 41
0 rows × 42 columns
神不在的星期二
有只小跳蛙
相关分类