jianxu305 / nCov2019_analysis

Analysis of 2019-nCov coronavirus data
GNU General Public License v3.0
117 stars 65 forks source link

suggest to remove the TTF from the package #1

Closed l1t1 closed 4 years ago

l1t1 commented 4 years ago

as it is too large to download, you could add the link of other place

jianxu305 commented 4 years ago

Removed the .TTF file. Now it use a default link. If that file doesn't exist on user's computer, then user need to specify the font file to properly display Chinese characters in plots. Please let me know if that's good for you. Thanks.

l1t1 commented 4 years ago

thanks, it works with some small problems

  1. the file utils.py seems in linux format, it need extra \0d under windows console.
  2. there are extra spaces lines at the end of function add_dailyNew(df), it raises SyntaxError
  3. the example in demo.pdf has extra utils. prefixes
  4. follwing statement returns empty
>>> daily_frm[daily_frm['updateDate'] == pd.to_datetime('2020-01-27')].head()
Empty DataFrame
Columns: [provinceName, cityName, confirmed, cured, dead, updateTime, updateDate]
Index: []
  1. following statement runs endlessly without anything after i press a extra enter key
city = '武汉'
fig = tsplot_conf_dead_cured(daily_frm[daily_frm['cityName'] == city], title_prefix=city, logy=True)
l1t1 commented 4 years ago
  1. crossectional_bar function name should be cross_sectional_bar
  2. running cross_sectional_bar has problems
>>> data = load_chinese_data()
最近更新于:  2020-02-05 13:42:32.850000
数据日期范围:  2020-01-24 to 2020-02-05
数据条目数:  17398
>>> daily_frm = aggDaily(data)
>>> cross_sectional_bar(daily_frm, '2020-02-05', col='confirmed', groupby='provinceName', title='各省确累计诊数比较')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 5, in cross_sectional_bar
  File "D:\Python35-32\lib\site-packages\pandas\plotting\_core.py", line 3171, in barh
    return self(kind='barh', x=x, y=y, **kwds)
  File "D:\Python35-32\lib\site-packages\pandas\plotting\_core.py", line 2942, in __call__
    sort_columns=sort_columns, **kwds)
  File "D:\Python35-32\lib\site-packages\pandas\plotting\_core.py", line 1973, in plot_frame
    **kwds)
  File "D:\Python35-32\lib\site-packages\pandas\plotting\_core.py", line 1801, in _plot
    plot_obj.generate()
  File "D:\Python35-32\lib\site-packages\pandas\plotting\_core.py", line 249, in generate
    self._compute_plot_data()
  File "D:\Python35-32\lib\site-packages\pandas\plotting\_core.py", line 367, in _compute_plot_data
    'plot'.format(numeric_data.__class__.__name__))
TypeError: Empty 'DataFrame': no numeric data to plot

and the daily_frm includes data of 2020-02-05

644           黑龙江省       鹤岗          2      0     0 2020-02-05 09:22:31.796  2020-02-05
645           黑龙江省       黑河          1      0     0 2020-02-05 09:22:31.796  2020-02-05
636           黑龙江省     齐齐哈尔         20      0     0 2020-02-05 09:22:31.796  2020-02-05

and if i modify the daily_frm['updateDate'], it works

>>> daily_frm['updateDate']=pd.to_datetime('2020-02-02')
>>> daily_frm['updateDate']
22841   2020-02-02
22839   2020-02-02
22840   2020-02-02
23185   2020-02-02
23713   2020-02-02
22870   2020-02-02
22864   2020-02-02

Name: updateDate, Length: 5269, dtype: datetime64[ns]
>>> cross_sectional_bar(daily_frm, '2020-02-02', col='confirmed', groupby='provinceName', title='各省确累计诊数比较')
<matplotlib.axes._subplots.AxesSubplot object at 0x08B65D10>
>>>
>>> fig=cross_sectional_bar(daily_frm, '2020-02-02', col='confirmed', groupby='provinceName', title='各省确累计诊数比较')
>>>
>>> plt.show()
l1t1 commented 4 years ago

and btw, suggest to add https://github.com/BlankerL/DXY-2019-nCoV-Data/archive/master.zip as data source, so that we can extract the data to local disk, and modify the line, such as _DXY_DATAPATH = 'd:/DXYArea.csv'

jianxu305 commented 4 years ago

cross_section_bar spelling error should be already fixed in an earlier checkin. Maybe you just need to pull?

I am actually using Window instead of Linux. I will look into the line break.

In the future, can you use open different issue for different problems? That will be easier for me to track the issues. Thanks.

l1t1 commented 4 years ago

i got your code by click green download button, the url is https://codeload.github.com/jianxu305/nCov2019_analysis/zip/master and i download it again a minute ago, the mis-spell is still there. i will post new issues as your wish, thanks.

jianxu305 commented 4 years ago

I am going to close this issue, since the .TTF problem is already solved. Please open new issue for every problems you encounter. Thanks.