]> code.communitydata.science - covid19.git/blob - keywords/analysis/translations_example.py
changes to allow historical view data collection
[covid19.git] / keywords / analysis / translations_example.py
1 import pandas as pd
2
3 # read the latest dataset
4 df  = pd.read_csv("https://covid19.communitydata.science/datasets/keywords/csv/latest.csv")
5
6 # find translations of "coronavirus"
7 coronavirus_itemids = df.loc[df.label.str.lower() == "coronavirus"]
8
9 # there are actually 5 item ids. The one referring to the family of virus is Q57751738
10 coronavirus_translations = df.loc[df.itemid == "http://www.wikidata.org/entity/Q57751738"]
11
12 # let's only look at unique, non-aliases
13 print(coronavirus_translations.loc[df.is_alt == False,['label','langcode']])

Community Data Science Collective || Want to submit a patch?