Mad*_*din 18 python dataframe python-3.x pandas
我有一个像这样的DataFrame(第一列是index(786 ...)和第二列day(25 ...)并且Rainfall amount是空的):
Day Rainfall amount (millimetres)
786 25
787 26
788 27
789 28
790 29
791 1
792 2
793 3
794 4
795 5
Run Code Online (Sandbox Code Playgroud)
我想删除790行.我用df.drop尝试了很多东西但是没有发生.
我希望你能帮助我.
fri*_*ist 46
在删除新的DataFrame时返回.如果要将更改应用于当前DataFrame,则必须指定inplace参数.
选项1
分配回df-
df = df.drop(790)
Run Code Online (Sandbox Code Playgroud)
选项2
Inplace参数 -
df.drop(790, inplace=True)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
18359 次 |
| 最近记录: |