如何在pandas中保存dta文件?
How to save dta file in pandas?
我使用此代码 df = df.to_dta("file_name.dta")
来保存 stata 文件。
它给了我这个错误:
AttributeError: 'DataFrame' object has no attribute 'to_dta'
有人知道在 python 中保存 Stata .dta 文件的正确代码是什么吗?
方法名称是.to_stata()
,不是.to_dta()
。
使用 pandas to_stata
DataFrame 方法。
df.to_stata("file_name.dta")
阅读文档:
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.to_stata.html
我使用此代码 df = df.to_dta("file_name.dta")
来保存 stata 文件。
它给了我这个错误:
AttributeError: 'DataFrame' object has no attribute 'to_dta'
有人知道在 python 中保存 Stata .dta 文件的正确代码是什么吗?
方法名称是.to_stata()
,不是.to_dta()
。
使用 pandas to_stata
DataFrame 方法。
df.to_stata("file_name.dta")
阅读文档: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.to_stata.html