Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
id_dict={'Andaman and Nicobar Islands': '0',
'Arunachal Pradesh': '1',
'Assam': '2',
'Bihar': '3',
'Chandigarh': '4',
'Chhattisgarh': '5',
'Dadra and Nagar Haveli': '6',
'Daman and Diu': '7',
'Goa': '8',
'Gujarat': '9',
'Haryana': '10',
'Himachal Pradesh': '11',
'Jharkhand': '12',
'Karnataka': '13',
'Kerala': '14',
'Lakshadweep': '15',
'Madhya Pradesh': '16',
'Maharashtra': '17',
'Manipur': '18',
'Meghalaya': '19',
'Mizoram': '20',
'Nagaland': '21',
'Delhi': '22',
'Puducherry': '23',
'Punjab': '24',
'Rajasthan': '25',
'Sikkim': '26',
'Tamil Nadu': '27',
'Telangana': '28',
'Tripura': '29',
'Uttar Pradesh': '30',
'Uttarakhand': '31',
'West Bengal': '32',
'Odisha': '33',
'Andhra Pradesh': '34',
'Jammu and Kashmir': '35',
'Ladakh': '36'}
# Creating IDs using the above dictionary
df_covid['state_id']=df_covid['Name of State / UT'].map(id_dict)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment