panda 速查
初始化
- 通过 list
df = pd.DataFrame([['a1', 1], ['a2', 4]], columns=['uid', 'score']) - 通过 Series (dict形式)
s=pd.Series(range(5)) p=pd.Series(range(5,10)) df=pd.DataFrame({'a':s,'b':p})
条件选择
- 按照列中value的长度选择:
df.loc[df['col_name'].str.len() >5]
完全匹配
部分匹配
str.contains():包含一个特定的字符串
参数na:缺少值NaN处理
参数case:大小写我的处理
参数regex:使用正则表达式模式
str.endswith():以特定字符串结尾
str.startswith():以特定的字符串开头
str.match():匹配正则表达式模式

浙公网安备 33010602011771号