📜  pandas 过滤字符串长度 - Python 代码示例

📅  最后修改于: 2022-03-11 14:47:17.789000             🧑  作者: Mango

代码示例1
import pandas as pd

df = pd.read_csv('filex.csv')
df['A'] = df['A'].astype('str')
df['B'] = df['B'].astype('str')
mask = (df['A'].str.len() == 10) & (df['B'].str.len() == 10)
df = df.loc[mask]
print(df)