import pandas as pd from pandas.io.stata import StataReader, StataWriter file="cfps2020famconf_202301.dta" stata_data = StataReader(file, convert_categoricals=False) data=stata_data.read() varlist = stata_data.varlist#变量名列表 value_labels = stata_data.value_labels() fmtlist = stata_data.fmtlist variable_labels = stata_data.variable_labels() ##data = pd.read_stata('cfps2020famconf_202301.dta') ##data.to_stata('output_file.dta') ##data.to_stata('output_file.dta', version=12) ###12版本号 默认为13 ###也可以使用statsmodels和rpy2来读取
标签:stata,python,读写,labels,##,file,data,dta From: https://www.cnblogs.com/xkdn/p/17177966.html