Skip to content

python translation of Clayton Thyne's replace_ccode_country.do stata file

License

Notifications You must be signed in to change notification settings

cbesaw/ccode_replace_python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ccode_replace_python

Python translation of Clayton Thyne's replace_ccode_country.do stata file

This script allows python users to utilize Clayton Thyne's Stata file for creating ccodes in country-level datasets. Allows for easy merging. Uses a modified text file of original stata code to scrape ccode numbers and country name strings.

UPDATE 2/27/2018: Added 13 additional non-uniform country strings based on NAP dataset. The changes are reflected in the clthyn.txt file

Credit for ccode/country information goes to Dr. Clayton Thyne at Kentucky. Process based on original .do file made by Thyne. See http://www.uky.edu/~clthyn2/research.htm for more information.

Example code

from replace_ccode_country import ccode_make

df = ccode_make(df, 'clthyn.txt', 'country')


Argument key

ccode_make(df, file_name, c_var)

  1. df = your data frame
  2. file_name = clayton thyne's do script in modified text form
  3. c_var = the original country string variable name from your df

About

python translation of Clayton Thyne's replace_ccode_country.do stata file

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages