How to access CDC Vaccine Adverse Reaction Reports with Python Code – BASIC

Read Time:1 Minute, 11 Second

How to access CDC Vaccine Adverse Reaction Reports with Python Code – BASIC

import pandas as pd
import re
pd.set_option(‘display.max_columns’, None)
vdata=pd.read_csv(‘2021VAERSData.csv’, encoding=’latin1′,low_memory=False)
vvax = pd.read_csv(‘2021VAERSVAX.csv’,encoding=’latin1′,low_memory=False)
vsymp = pd.read_csv(‘2021VAERSSYMPTOMS.csv’,encoding=’latin1′,low_memory=False)
vdata.head()
vvax.head()
vsymp.head()
tt = vsymp.duplicated(subset=[‘VAERS_ID’])
tt = tt.value_counts()
print(tt)
a = len(vdata)
b = len(vvax)
c = len(vsymp)
print(a,b,c)
vt= vdata.duplicated(subset=[“VAERS_ID”])
vt= (vt.value_counts())
vv= vvax.duplicated(subset=[“VAERS_ID”])
vv= (vv.value_counts())
vs= vsymp.duplicated(subset=[“VAERS_ID”])
vs= (vs.value_counts())
print(vt,’\n’,vv,’\n’,vs)
v1 = vdata.merge(vvax, on=’VAERS_ID’, how=’outer’)
v1
VAERSM = v1.merge(vsymp, on =”VAERS_ID”, how=’outer’)
VAERSM
test = VAERSM.duplicated(subset=[“VAERS_ID”])
test.value_counts()
VAERSM.info()
found = VAERSM[VAERSM[‘SYMPTOM_TEXT’].str.contains(‘blind’,na=False, flags=re.IGNORECASE, regex=True)]
found
refine = found.drop_duplicates(subset=[‘VAERS_ID’],keep=’first’)
refine
pd.set_option(‘display.max_colwidth’, None)
refine[[‘VAERS_ID’,’SYMPTOM_TEXT’]]
pd.set_option(‘display.max_colwidth’, 100)
rr = VAERSM.query(‘DIED==”Y”‘)
rr
pd.set_option(‘display.max_colwidth’, None)
r = rr.drop_duplicates(subset=[‘VAERS_ID’],keep=’first’)
r[[‘VAERS_ID’,’SYMPTOM_TEXT’]]

https://vaers.hhs.gov/data.html



Categories: All Posts

Tags: , , , , , , , , , , , , ,

Average Rating

5 Star
0%
4 Star
0%
3 Star
0%
2 Star
0%
1 Star
0%
%d bloggers like this: