Skip to content

Instantly share code, notes, and snippets.

@abhishek-shrm
Created April 21, 2020 12:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abhishek-shrm/9cd1e34d73b828818d8303f6aec90f4c to your computer and use it in GitHub Desktop.
Save abhishek-shrm/9cd1e34d73b828818d8303f6aec90f4c to your computer and use it in GitHub Desktop.
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