Skip to content

Instantly share code, notes, and snippets.

@BexTuychiev
Last active July 14, 2020 09:16
Show Gist options
  • Save BexTuychiev/3562c0c9ff75279addf6c9bac667f48c to your computer and use it in GitHub Desktop.
Save BexTuychiev/3562c0c9ff75279addf6c9bac667f48c to your computer and use it in GitHub Desktop.
# Importing a stata file
import pandas as pd
dta = pd.read_stata('cola.dta')
print(dta)
# Saving as a stata file
# Read any csv file or any DataFrame
df = pd.read_csv('sample.csv')
# Save as .dta file
df.to_stata('sample.dta')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment