Reputation: 35
I used this code df = df.to_dta("file_name.dta")
to save stata file.
It gives me this error:
AttributeError: 'DataFrame' object has no attribute 'to_dta'
Does anybody know what is the correct code to save a Stata .dta file in python?
Upvotes: 1
Views: 840
Reputation: 58
use the pandas to_stata
DataFrame method.
df.to_stata("file_name.dta")
Read the documentation: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.to_stata.html
Upvotes: 1