Pandas 删除指定列中为NaN的行
2024-08-29 20:11:08
定位要删除的行
需求:删除指定列中NaN所在行。
如下图,’open‘ 列中有一行为NaN,定位到它,然后删除。
定位:
df[np.isnan(df['open'])].index
# 这样即可定位到所在行的index,然后对该index进行drop操作即可
删除行
df.drop(df[np.isnan(df['open'])].index, inplace=True) # 直接drop对应indx即可删除该行
最新文章
- luogg_java学习_10_异常_反射
- springmvc HandlerInterceptoer WebRequestInterceptor MethodInterceptor使用
- 开发板支持wifi
- ASP.NET 5系列教程(七)完结篇-解读代码
- HttpClient实现客户端与服务器的通信
- Codeforces Round #365 (Div. 2) A 水
- open_clientfd(char* hostname,int port)和open_listenfd(int port)
- hdoj 2036 改革春风吹满地
- bzoj2337
- 通过MyEclipse工具直接操作数据库,执行sql语句,方便快捷
- Project 6:上楼梯问题
- 单独创建一个Android Test Project 时junit 的配置和使用
- 日志模块---logging
- HTML与HTML5复习标签汇总
- K2签约龙光地产,为集团实现“千亿目标”保驾护航
- “XmlDocumentationProvider”不实现接口成员“IDocumentationProvider.GetDocumentation(HttpControllerDescriptor)”错误的解决方案
- Centos下软件包管理
- 十分钟搞定mac下的phpstorm增加xdebug调试
- Linux 搭建Nginx并添加配置 SSL 证书
- BZOJ 2190 仪仗队(线性筛欧拉函数)