COVID-19 cases for data analysis (2)

in #python5 years ago (edited)

Last days US new cases rate is increased twice up to 10K new cases per day.

<p dir="auto"><img src="https://images.hive.blog/768x0/https://files.peakd.com/file/peakd-hive/fooblic/HjqZQgse-increase.png" alt="increase.png" srcset="https://images.hive.blog/768x0/https://files.peakd.com/file/peakd-hive/fooblic/HjqZQgse-increase.png 1x, https://images.hive.blog/1536x0/https://files.peakd.com/file/peakd-hive/fooblic/HjqZQgse-increase.png 2x" /> <p dir="auto">Total confirmed cases in US already outrun other countries and could exceed Italy cases quantity soon. <p dir="auto"><img src="https://images.hive.blog/768x0/https://files.peakd.com/file/peakd-hive/fooblic/zLBq1dAQ-confirmed.png" alt="confirmed.png" srcset="https://images.hive.blog/768x0/https://files.peakd.com/file/peakd-hive/fooblic/zLBq1dAQ-confirmed.png 1x, https://images.hive.blog/1536x0/https://files.peakd.com/file/peakd-hive/fooblic/zLBq1dAQ-confirmed.png 2x" /> <p dir="auto">Data source: CSSE at Johns Hopkins University -> <a href="https://github.com/CSSEGISandData/COVID-19" target="_blank" rel="nofollow noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">github <p dir="auto">Python code using Pandas: <pre><code>df = pd.read_csv("./csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_confirmed_global.csv") # new data file ... def country_increase(name): count = [] for i in range(0,num-1): count.append(incr[name][i+1] - incr[name][i]) return count count = {} for country in ("Italy", "US"): count[country] = country_increase(country) index = np.arange(len(data.index[1:])) result = pd.DataFrame(count, index=index) bar_width = 0.35 plt.bar(index, result["Italy"], bar_width, color="b", label="Italy") plt.bar(index + bar_width, result["US"], bar_width, color="k", label="US") plt.title("Daily increase") plt.xticks(index, data.index[1:].strftime('%Y-%m-%d')) plt.xticks(rotation=70) plt.legend(loc=2) plt.tight_layout() plt.show() <p dir="auto">Please see my previous post for more details: <a href="https://peakd.com/python/@fooblic/covid-19-cases-for-data-analysis" target="_blank" rel="nofollow noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">1