In [45]:
import pandas as pd
In [46]:
df = pd.read_csv("/home/ben/Code/django-calaccess-processed-data/example/django.log", sep="|")
In [47]:
df.head()
Out[47]:
In [48]:
df.columns = ['level', 'time', 'logger', 'message']
In [49]:
df = df[df.logger == 'candidates']
In [50]:
def method(message):
if 'based' in message:
return message.split("based on")[-1]
else:
return message.split("after")[-1]
In [51]:
df['reason'] = df.message.apply(method)
In [52]:
df.reason.value_counts()
Out[52]:
In [53]:
df[df.reason.str.contains("correction")]
Out[53]: