Coder Social home page Coder Social logo

Comments (4)

TobyPhillips avatar TobyPhillips commented on August 18, 2024

Thanks for flagging this. We seem to have an issue with the way we pull forward data internally. It is fine for days up to 31 May (I think), but breaks after that. We have identified the cause and just figuring out the best way to fix it.

from covid-policy-tracker.

TobyPhillips avatar TobyPhillips commented on August 18, 2024

I think we have this fixed now; let me know if you still see an issue.
-Toby

from covid-policy-tracker.

KlausGPaul avatar KlausGPaul commented on August 18, 2024

Thanks, Toby,
will check and get back to you tomorrow. If you find it useful, here is my code snippet I use to pad the data which also prints could country ISO3's and number of days missing.

dfOxCGRT = pd.read_csv("./OxCGRT_latest.csv")[["CountryCode","Date","StringencyIndexForDisplay"]]
dfOxCGRT.rename(columns={'StringencyIndexForDisplay':'string_idx'},inplace=True)

dfOxCGRT["date"] = pd.to_datetime(dfOxCGRT.Date,format="%Y%m%d")
del dfOxCGRT["Date"]

alldf = []

for country_code in dfOxCGRT.CountryCode.unique():
    ddf = dfOxCGRT[(dfOxCGRT.CountryCode == country_code)&(dfOxCGRT.string_idx>=0)]
    if len(ddf)<= 0:
        continue
    last_entry = ddf.date.max()
    age = pd.to_datetime(datetime.date.today()-datetime.timedelta(days=1))-last_entry
    age_days = int(age.total_seconds()/86400)
    if age_days > 1:
        string_idx = ddf[ddf.date == last_entry].string_idx.values[0]
        print("{} {} ({})".format(country_code,age_days,string_idx),end="..")
        alldata = []
        for i in range(age_days+1):
            newdate = last_entry+datetime.timedelta(days=i)#).date()
            alldata.append({"CountryCode":country_code,
                            "string_idx":string_idx,
                            "date":newdate})
        alldf.append(ddf.append(pd.DataFrame(alldata)))
    else:
        print("{} OK".format(country_code),end="..")
        alldf.append(ddf)
        
dfOxCGRT_padded = pd.DataFrame().append(alldf)
dfOxCGRT_padded.reset_index(inplace=True)
del dfOxCGRT_padded["index"]
dfOxCGRT_padded.to_parquet("./OxCGRT_timeseries_all.parquet")

from covid-policy-tracker.

KlausGPaul avatar KlausGPaul commented on August 18, 2024

StringencyIndexForDisplay now is padded as intended, issue is closed.
Thanks for your help!
Klaus

from covid-policy-tracker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.