美文网首页
选取非空行

选取非空行

作者: 492284513d5a | 来源:发表于2020-04-20 19:28 被阅读0次
    
    >>> import pandas as pd         
    >>> df = pd.read_csv('test.csv')
    >>> print df
           name   id
    0  ZhangSan  1.0
    1      LiSi  2.0
    2    WangEr  NaN
    3     WanZi  4.0
    >>> print df['id'].notnull()    
    0     True
    1     True
    2    False
    3     True
    Name: id, dtype: bool
    >>> print df[df['id'].notnull()]
    ===========================================================
    #删除重复列
    DataFrame.drop_duplicates(self, subset: Union[Hashable, Sequence[Hashable], NoneType] = None, keep: Union[str, bool] = 'first', inplace: bool = False, ignore_index: bool = False) → Union[ForwardRef('DataFrame'), NoneType]
    ===========================================================
    
    
    
    

    相关文章

      网友评论

          本文标题:选取非空行

          本文链接:https://www.haomeiwen.com/subject/mymjihtx.html