Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit59bbccb

Browse files
committed
ENH: autodecode pandas timestamps
1 parentd2e68ff commit59bbccb

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

‎lib/matplotlib/dates.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,10 @@ def date2num(d):
430430
For details see the module docstring.
431431
"""
432432

433+
ifhasattr(d,"values"):
434+
# this unpacks pandas series or dataframes...
435+
d=d.values
436+
433437
if ((isinstance(d,np.ndarray)andnp.issubdtype(d.dtype,np.datetime64))
434438
orisinstance(d,np.datetime64)):
435439
return_dt64_to_ordinalf(d)

‎lib/matplotlib/units.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,10 @@ def get_converter(self, x):
160160
ifclassxisnotNone:
161161
converter=self.get(classx)
162162

163+
ifconverterisNoneandhasattr(x,"values"):
164+
# this unpacks pandas series or dataframes...
165+
x=x.values
166+
163167
# If x is an array, look inside the array for data with units
164168
ifisinstance(x,np.ndarray)andx.size:
165169
xravel=x.ravel()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp