Data were munged here.


In [1]:
import pandas as pd
import numpy as np
from IPython.core.display import display, HTML
display(HTML("<style>.container { width:100% !important; }</style>"))
df = pd.read_csv('../../data/processed/complaints-3-29-scrape.csv')


How many complaints at Pacific Gardens (in 2015 were for medication errors?


In [2]:
df[(df['facility_id']=='5MA223') & (df['year']==2015) & (df['outcome'].str.contains('edication'))].count()[0]


Out[2]:
17

In how many months did these occur?


In [3]:
df['incident_date'][(df['facility_id']=='5MA223') & (df['year']==2015) & (df['outcome'].str.contains('edication'))]


Out[3]:
8499    2015-03-11
8500    2015-03-05
8501    2015-03-19
8502    2015-03-14
8503    2015-01-07
8504    2015-02-25
8505    2015-01-09
8507    2015-02-06
8508    2015-01-28
8509    2015-01-01
8521    2015-04-08
8522    2015-04-02
8523    2015-04-06
8524    2015-03-15
8528    2015-04-11
8529    2015-04-07
8530    2015-04-01
Name: incident_date, dtype: object

Between January and April.

How many of these complaints are not online?


In [4]:
df[(df['facility_id']=='5MA223') & 
   (df['year']==2015) & 
   (df['outcome'].str.contains('edication')) &
   (df['public']=='offline')
  ].count()[0]


Out[4]:
16

DONE