Skip to content

Instantly share code, notes, and snippets.

@ericgitonga
Created May 25, 2021 09:43
Show Gist options
  • Save ericgitonga/76c101319e5e95ba057e50b677dba76d to your computer and use it in GitHub Desktop.
Save ericgitonga/76c101319e5e95ba057e50b677dba76d to your computer and use it in GitHub Desktop.
Code to see determine which items in place had only one entry
place = df['Location'].apply(lambda x: x.split(', '))
stateless = []
for i in range(len(place)):
if len(place.loc[i]) == 1:
place.loc[i].append(np.nan)
stateless.append(place[i][0])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment