Jun-09-2022, 02:58 PM
set_xticks is expecting a list of str
Quote:matplotlib.axes.Axes.set_xticksPandas date_range returns a Datetimeindex. A Datetimeindex is an immutable ndarray-like of datetime64 data
Axes.set_xticks(ticks, labels=None, *, minor=False, **kwargs)[source]
Set the xaxis' tick locations and optionally labels.
If necessary, the view limits of the Axis are expanded so that all given ticks are visible.
Parameters
tickslist of floats
List of tick locations.
labelslist of str, optional
List of tick labels. If not set, the labels show the data value.
minorbool, default: False
If False, set the major ticks; if True, the minor ticks.
**kwargs
Text properties for the labels. These take effect only if you pass labels. In other cases, please use tick_params.
Quote:pandas.DatetimeIndexSo when you call pandas.daterange() you are getting back an array of things that look like 64 bit integers, not strings. Do you want a bunch of really big integers appearing as tick labels?
class pandas.DatetimeIndex(data=None, freq=NoDefault.no_default, tz=None, normalize=False, closed=None, ambiguous='raise', dayfirst=False, yearfirst=False, dtype=None, copy=False, name=None)[source]
Immutable ndarray-like of datetime64 data.
Represented internally as int64, and which can be boxed to Timestamp objects that are subclasses of datetime and carry metadata.