Skip to content

Instantly share code, notes, and snippets.

@mindey

mindey/columns-mortality-us.txt Secret

Created Apr 15, 2018
Embed
What would you like to do?
# 1st Columns Rename Map
colmap={"Autopsy Performed ": "Autopsy",
"Age Recode 12 (*)": "Age Recode 12",
"Age Recode 27 (*)": "Age Recode 27",
"Age Recode 52 (*)": "Age Recode 52",
"CMSA of Residence (FIPS)": "CMSA of Residence",
"City": "City of Residence",
"City of Residence (FIPS)": "City of Residence",
"County": "County of Residence",
"Country of Residence (FIPS)": "County of Residence",
"County of Residence (FIPS)": "County of Residence",
"County of Occurrence (FIPS)": "County of Occurrence",
"County of Occurence (FIPS)": "County of Occurrence",
"Day": "Day of Week of Death",
"Division and State Subcode of Occurrence (*)": "Division and State Subcode of Occurrence",
"Division and State Subcode of Residence (*)": "Division and State Subcode of Residence",
"Expanded State of Occurrence Code (*)": "Expanded State of Occurrence Code",
"Expanded State of Residence Code (*)": "Expanded State of Residence Code",
"Infant Age Recode 22 (*)": "Infant Age Recode 22",
"Metropolitan-Nonmetropolitan County of Residence (*)": "Metropolitan-Nonmetropolitan County of Residence",
"Month": "Month of Death",
"NCHS Standard Metropolitan Statistical Area (SMSA)": "NCHS PMSA/MSA of Residence",
"NCHS Standard Metropolitan Statistical Area (SMSA) of Residence": "NCHS PMSA/MSA of Residence",
"Population Size of City of Residence (*)": "Population Size of City of Residence",
"PMSA/MSA Population Size": "PMSA/MSA Population Size of Residence",
"PMSA/MSA of Residence": "PMSA/MSA of Residence (FIPS)",
"Population Size of City of Residence (*)": "Population Size of City of Residence",
"Population Size of Residence": "Population Size of City of Residence",
"Race Recode 2 (*)": "Race Recode 2",
"Race Recode 3 (*)": "Race Recode 3",
"Record Type (*)": "Record Type",
"Region (*)": "Region",
"Resident Status (*)": "Resident Status",
"Sequence Number (*)": "Sequence Number",
"State of Birth (FIPS)": "State of Birth",
"State of Occurence (FIPS)": "State of Occurrence (FIPS)"}
# 2nd Columns Rename Map
General rule:
# order for those variable names which start with number, swapped:
# 00 Condition -> condition_00
# 00 Cause Recode -> cause_recode_00
# 00 Infant Cause Recode -> infant_cause_recode_00
# capital letters to small letters
# / replaced as __
# ( replaced as _
# ) replaced as _
# replaced as _
# - replaced as __
# . replaced as _
# , replaced as _
# * replaced as x
Specifically:
colmap= {'10th Condition': 'condition_10',
'113 Cause Recode': 'cause_recode_113',
'11th Condition': 'condition_11',
'12th Condition': 'condition_12',
'130 Infant Cause Recode': 'infant_cause_recode_130',
'13th Condition': 'condition_13',
'14th Condition': 'condition_14',
'15th Condition': 'condition_15',
'16th Condition': 'condition_16',
'17th Condition': 'condition_17',
'18th Condition': 'condition_18',
'19th Condition': 'condition_19',
'1st Condition': 'condition_1',
'20th Condition': 'condition_20',
'282 Cause Recode': 'cause_recode_282',
'2nd Condition': 'condition_2',
'34 Cause Recode': 'cause_recode_34',
'358 Cause Recode': 'cause_recode_358',
'39 Cause Recode': 'cause_recode_39',
'3rd Condition': 'condition_3',
'4th Condition': 'condition_4',
'52 Cause Recode': 'cause_recode_52',
'5th Condition': 'condition_5',
'61 Infant Cause Recode': 'infant_cause_recode_61',
'6th Condition': 'condition_6',
'72 Cause Recode': 'cause_recode_72',
'7th Condition': 'condition_7',
'8th Condition': 'condition_8',
'9th Condition': 'condition_9',
'Activity Code': 'activity_code',
'Age Recode 12': 'age_recode_12',
'Age Recode 27': 'age_recode_27',
'Age Recode 52': 'age_recode_52',
'Age Substitution Flag': 'age_substitution_flag',
'Autopsy': 'autopsy',
'Autopsy Performed': 'autopsy_performed',
'Bridged Race Flag': 'bridged_race_flag',
'Business or Industry Recode 15': 'business_or_industry_recode_15',
'Business or Industry Recode 51': 'business_or_industry_recode_51',
'CMSA of Residence': 'cmsa_of_residence',
'Calculated Detail Age': 'calculated_detail_age',
'Certificate Number': 'certificate_number',
'City of Residence': 'city_of_residence',
'County of Occurrence': 'country_of_occurrance',
'County of Residence': 'country_of_residence',
'Current Data Year': 'current_data_year',
'Day of Week of Death': 'day_of_week_of_death',
'Detail Age': 'detail_age',
'Detail Race': 'detail_race',
'Division and State Subcode of Occurrence': 'division_and_state_subcode_of_occurrance',
'Division and State Subcode of Residence': 'division_and_state_subcode_of_residence',
'Education': 'education',
'Education (1989 revision)':'education_1989_revision',
'Education (2003 revision)':'education_2003_revision',
'Education Recode': 'education_recode',
'Education reporting flag': 'education_reporting_flag',
'Expanded State of Occurrence Code': 'expanded_state_of_occurrance_code',
'Expanded State of Residence Code': 'expanded_state_of_residence_code',
'FIPS SMSA': 'fips_smsa',
'Hispanic Origin': 'hispanic_origin',
'Hispanic Origin/Race Recode': 'hispanic_origin__race_recode',
'Hospital and Status': 'hospital_and_status',
'ICD Code (10th Revision)':'icd_code_10th_revision',
'ICD Code (9th Revision)': 'icd_code_9th_revision',
'Infant Age Recode 22': 'infant_age_recode_22',
'Injury at Work': 'injury_at_work',
'Kind of Business or Industry': 'kind_of_business_or_industry',
'Last 2 Digits of Current Data Year': 'last_2_digits_of_current_data_year',
'Manner of Death': 'manner_of_death',
'Marital Status': 'marital_status',
'Method of Disposition': 'method_of_disposition',
'Metropolitan-Nonmetropolitan County of Residence': 'metropolitan__nonmetropolitan_county_of_residence',
'Month of Death': 'month_of_death',
'NCHS PMSA/MSA of Residence': 'nchs_pmsa__msa_of_residence',
'Number of Entity-Axis Conditions': 'number_of_entity__axis_conditions',
'Number of Record-Axis Conditions': 'number_of_record__axis_conditions',
'Origin or Descent': 'origin_or_descent',
'PMSA/MSA Population Size of Residence': 'pmsa__msa_population_size_of_residence',
'PMSA/MSA of Residence (FIPS)': 'pmsa__msa_of_residence_fips',
'Place (city) of Residence (FIPS)': 'place__city__of_residence_fips',
'Place of Accident for Causes E850-E869 and E880-E928': 'place_of_accident_for_causes_e850__e869_and_e880__e928',
'Place of Accident for Causes E850-E929': 'place_of_accident_for_causes_e850__e929',
"Place of Death and Decedent's Status": 'place_of_death_and_decedents_status',
'Place of Injury for Causes W00-Y34, except Y06.- and Y07.-': 'place_of_injury_for_causes_w00__y34__except_y06____and_y07___',
'Population Size of City of Residence': 'population_size_of_city_of_residence',
'Population Size of County of Occurrence': 'population_size_of_county_of_occurrance',
'Population Size of County of Residence': 'population_size_of_county_of_residence',
'Population Size of PMSA/MSA': 'population_size_of_pmsa__msa',
'Population Size of SMSA': 'population_size_of_smsa',
'Race': 'race',
'Race Imputation Flag': 'race_imputation_flag',
'Race Recode 2': 'race_recode_2',
'Race Recode 3': 'race_recode_3',
'Race Recode 5': 'race_recode_5',
'Record Type': 'record_type',
'Region': 'region',
'Reporting Area': 'reporting_area',
'Reserved': 'reserved',
'Reserved Position': 'reserved_position',
'Reserved Position (TRANSAX flag)': 'reserved_position__transax_flag_',
'Reserved Positions': 'reserved_positions',
'Reserved position': 'reserved_position',
'Resident Status': 'resident_status',
'SMSA of Residence': 'smsa_of_residence',
'Sequence Number': 'sequence_number',
'Sex': 'sex',
'Shipment Number': 'shipment_number',
'Standard Metropolitan Statistical Area (SMSA) (*)': 'standard_metropolitan_statistical_area__smsa___x_',
'State': 'state',
'State of Birth': 'state_of_birth',
'State of Occurrence': 'state_of_occurrence',
'State of Occurrence (FIPS)': 'state_of_occurrence__fips_',
'State of Residence': 'state_of_residence',
'State of Residence (FIPS)': 'state_of_residence__fips_',
'State/Country of Birth Recode': 'state__country_of_birth_recode',
'State/Country of Residence Recode': 'state__country_of_residence_recode',
'Usual Occupation': 'usual_occupation',
'Usual Occupation Recode 59': 'usual_occupation_recode_59',
'Usual Occupation Recode 9': 'usual_occupation_recode_9'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.