Skip to content

Instantly share code, notes, and snippets.

@aandr
Created January 28, 2016 11:29
Show Gist options
  • Save aandr/5402294ba1fd46a18c79 to your computer and use it in GitHub Desktop.
Save aandr/5402294ba1fd46a18c79 to your computer and use it in GitHub Desktop.
import pandas
import numpy as np
from collections import defaultdict
data = pandas.read_csv("/Users/alek/Downloads/agenti3.csv", skiprows=1)
blanks = [None, '', ' ', 'Неустановена приналежност', 'Неустановена принедлежност', 'Няма данни', 'Неустановане принадлежност', 'Неустановена пренадлежност', 'Нустановена принадлежност', 'Неустанована принадлежност', 'Неустановена принадлежност']
data['is_agent'] = data['Установена принадлежност'].map(lambda x: x not in blanks)
print("Number of checked persons", len(data))
data = data[data['is_agent'] == True]
print("Numebr of agents", len(data))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment