1.pandas常用函数
函数 | 说明 |
pd.isnull(series) pd.notnull(series) | 判断是否为空(NaN) 判断是否不为空(not NaN) |
2.使用示例
2.1code
-
# -*- coding: utf-8 -*-
-
"""
-
@author: 蔚蓝的天空Tom
-
Aim:pandas的常用函数的例程
-
"""
-
-
import pandas
as pd
-
-
def pandas_manual():
-
'''pandas常用函数
-
'''
-
s = pd.Series([
1,
3,
5])
-
-
#判断是否为空(NaN)
-
ret = pd.isnull(s)
#<class 'pandas.core.series.Series'>
-
# 0 False
-
# 1 False
-
# 2 False
-
# dtype: bool
-
-
-
#判断是否不为空(not NaN)
-
ret = pd.notnull(s)
#<class 'pandas.core.series.Series'>
-
# 0 True
-
# 1 True
-
# 2 True
-
# dtype: bool
-
-
if __name__==
'__main__':
-
pandas_manual()
(end)