1.安装pandas
pip install pandas -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host=mirrors.aliyun.com/pypi/simple
import pandas as pd df = pd.read_csv(r'C:\Users\admin\Desktop\国家信息数据 csv\DEA_PURCHASE_ANNO.csv') for i, col in enumerate(df.columns.tolist()): df[col] = df[col].astype(str) n_max = df[col].str.len().max() print(i, n_max)
标签:mirrors,df,max,col,长度,csv,pandas From: https://www.cnblogs.com/kanbujiandeheiye/p/16644003.html