Site icon CLINICALNEWS.ORG

How to download Variants of Concern Data, using python

Vcd
YouTube player

How to download Variants of Concern Data, using python

Pretty Easy, once you can link it. No saving files necessary

#variants #gisaid #python

import pandas as pd

import plotly.express as px

variants=pd.read_csv(‘https://github.com/owid/covid-19-data/blob/master/public/data/variants/covid-variants.csv?raw=true’,parse_dates = [‘date’])

variants[variants[‘location’]==”Hungary”].tail(50)

omi = variants[variants[‘variant’]==’Omicron’]

mix = variants.groupby([‘date’,’variant’])[‘perc_sequences’].mean().reset_index()

varp=  variants.groupby([‘location’,’variant’])[[‘date’, ‘perc_sequences’]].last().reset_index()

varp= varp.query(‘perc_sequences > 0’) #greater than size

varp[‘date’] = varp[‘date’].dt.strftime(‘%m/%d/%Y’)

fig = px.bar( varp, x= ‘location’, y=’perc_sequences’, color=’variant’, hover_data= [‘variant’,’date’], height=900)

fig.update_layout(legend_traceorder=”normal”,template=’plotly_dark’,legend=dict(

        itemclick=”toggleothers”,

        itemdoubleclick=”toggle”,itemsizing=’trace’),hoverlabel=dict(

        bgcolor=”red”,

        font_size=30,

        font_family=”Rockwell”

    )   )

fig.show()

Exit mobile version