BUG: Plotting with DatetimeIndex with specific time step results in MemoryError · Issue #53684 · pandas-dev/pandas (original) (raw)
MemoryError: Unable to allocate 24.8 GiB for an array with shape (3332666625,) and data type int64
Traceback (most recent call last):
File "mypath/lib/python3.10/site-packages/matplotlib/backends/backend_qt.py", line 468, in _draw_idle
self.draw()
File "mypath/lib/python3.10/site-packages/matplotlib/backends/backend_agg.py", line 400, in draw
self.figure.draw(self.renderer)
File "mypath/lib/python3.10/site-packages/matplotlib/artist.py", line 95, in draw_wrapper
result = draw(artist, renderer, *args, **kwargs)
File "mypath/lib/python3.10/site-packages/matplotlib/artist.py", line 72, in draw_wrapper
return draw(artist, renderer)
File "mypath/lib/python3.10/site-packages/matplotlib/figure.py", line 3140, in draw
mimage._draw_list_compositing_images(
File "mypath/lib/python3.10/site-packages/matplotlib/image.py", line 131, in _draw_list_compositing_images
a.draw(renderer)
File "mypath/lib/python3.10/site-packages/matplotlib/artist.py", line 72, in draw_wrapper
return draw(artist, renderer)
File "mypath/lib/python3.10/site-packages/matplotlib/axes/_base.py", line 3064, in draw
mimage._draw_list_compositing_images(
File "mypath/lib/python3.10/site-packages/matplotlib/image.py", line 131, in _draw_list_compositing_images
a.draw(renderer)
File "mypath/lib/python3.10/site-packages/matplotlib/artist.py", line 72, in draw_wrapper
return draw(artist, renderer)
File "mypath/lib/python3.10/site-packages/matplotlib/axis.py", line 1376, in draw
ticks_to_draw = self._update_ticks()
File "mypath/lib/python3.10/site-packages/matplotlib/axis.py", line 1262, in _update_ticks
major_locs = self.get_majorticklocs()
File "mypath/lib/python3.10/site-packages/matplotlib/axis.py", line 1484, in get_majorticklocs
return self.major.locator()
File "mypath/lib/python3.10/site-packages/pandas/plotting/_matplotlib/converter.py", line 982, in __call__
locs = self._get_default_locs(vmin, vmax)
File "mypath/lib/python3.10/site-packages/pandas/plotting/_matplotlib/converter.py", line 962, in _get_default_locs
self.plot_obj.date_axis_info = self.finder(vmin, vmax, self.freq)
File "mypath/lib/python3.10/site-packages/pandas/plotting/_matplotlib/converter.py", line 581, in _daily_finder
dates_ = period_range(start=vmin, end=vmax, freq=freq)
File "mypath/lib/python3.10/site-packages/pandas/core/indexes/period.py", line 545, in period_range
data, freq = PeriodArray._generate_range(start, end, periods, freq, fields={})
File "mypath/lib/python3.10/site-packages/pandas/core/arrays/period.py", line 313, in _generate_range
subarr, freq = _get_ordinal_range(start, end, periods, freq)
File "mypath/lib/python3.10/site-packages/pandas/core/arrays/period.py", line 1079, in _get_ordinal_range
data = np.arange(start.ordinal, end.ordinal + 1, mult, dtype=np.int64)
numpy.core._exceptions._ArrayMemoryError: Unable to allocate 24.8 GiB for an array with shape (3332666625,) and data type int64
I'm not sure why this is happening. The data is very small and should be no problem.
If I change some timestamp a bit, there is no error.
It might be related to issue #20575. There is no frequency information in this DataFrame, though.
It should plot the data.