Closed dshemetov closed 3 years ago
@sarah-colq I hear you're interested in working more on the client packages; want to take this one?
Hm, I can't reproduce this.
In the code, this line is already here, and the df returned has that colume as a datetime object. You example error also fails to error for me. The cast was in an early PR so doubt it's a version error, but to be thorough have you tried upgrading to the latest version?
In [10]: df = covidcast.signal("jhu-csse", "deaths_incidence_num", geo_type="state", start_day=date(2020, 11, 1))
In [11]: df.dtypes
Out[11]:
geo_value object
signal object
time_value datetime64[ns]
issue datetime64[ns]
lag int64
value int64
stderr object
sample_size object
geo_type object
data_source object
dtype: object
In [12]: df.time_value
Out[12]:
0 2020-11-01
...
51 2020-11-14
Name: time_value, Length: 728, dtype: datetime64[ns]
In [16]: plt.plot(df[df["geo_value"] == "ca"].set_index("time_value")["value"])
Out[16]: [<matplotlib.lines.Line2D at 0x7fdd21f81cd0>]
Huh, the error seems to be gone on my end now?? 🤷
Well I guess I'll close for now, if it comes up again we can reopen and investigate.
Currently, we have to do this
If you don't cast to datetime, you can't plot in matplotlib with the
time_value
as the index.Should require just a one line change in the Python client. That
pd.to_datetime
function is idempotent, so it shouldn't break anyone's code that is already doing that manually.