@@ -306,23 +306,21 @@ def _from_ordinalf(x, tz=None):
306
306
if tz is None :
307
307
tz = _get_rc_timezone ()
308
308
309
- ix = int (x )
309
+ ix , remainder = divmod (x , 1 )
310
+ ix = int (ix )
310
311
if ix < 1 :
311
- raise ValueError ('cannot convert {} to a date. This '
312
- 'often happens if non-datetime values are passed to '
313
- 'an axis that expects datetime objects. '
314
- .format (ix ))
312
+ raise ValueError ('Cannot convert {} to a date. This often happens if '
313
+ 'non-datetime values are passed to an axis that '
314
+ 'expects datetime objects.' .format (ix ))
315
315
dt = datetime .datetime .fromordinal (ix ).replace (tzinfo = UTC )
316
316
317
- remainder = float (x ) - ix
318
-
319
317
# Since the input date `x` float is unable to preserve microsecond
320
318
# precision of time representation in non-antique years, the
321
319
# resulting datetime is rounded to the nearest multiple of
322
320
# `musec_prec`. A value of 20 is appropriate for current dates.
323
321
musec_prec = 20
324
- remainder_musec = int (round (remainder * MUSECONDS_PER_DAY /
325
- float ( musec_prec )) * musec_prec )
322
+ remainder_musec = int (round (remainder * MUSECONDS_PER_DAY / musec_prec )
323
+ * musec_prec )
326
324
327
325
# For people trying to plot with full microsecond precision, enable
328
326
# an early-year workaround
@@ -1287,10 +1285,10 @@ def get_locator(self, dmin, dmax):
1287
1285
# these similar functions, and it's best to avoid doing our own math
1288
1286
# whenever possible.
1289
1287
numYears = float (delta .years )
1290
- numMonths = ( numYears * MONTHS_PER_YEAR ) + delta .months
1288
+ numMonths = numYears * MONTHS_PER_YEAR + delta .months
1291
1289
numDays = tdelta .days # Avoids estimates of days/month, days/year
1292
- numHours = ( numDays * HOURS_PER_DAY ) + delta .hours
1293
- numMinutes = ( numHours * MIN_PER_HOUR ) + delta .minutes
1290
+ numHours = numDays * HOURS_PER_DAY + delta .hours
1291
+ numMinutes = numHours * MIN_PER_HOUR + delta .minutes
1294
1292
numSeconds = np .floor (tdelta .total_seconds ())
1295
1293
numMicroseconds = np .floor (tdelta .total_seconds () * 1e6 )
1296
1294
@@ -1745,14 +1743,14 @@ def seconds(s):
1745
1743
"""
1746
1744
Return seconds as days.
1747
1745
"""
1748
- return float ( s ) / SEC_PER_DAY
1746
+ return s / SEC_PER_DAY
1749
1747
1750
1748
1751
1749
def minutes (m ):
1752
1750
"""
1753
1751
Return minutes as days.
1754
1752
"""
1755
- return float ( m ) / MINUTES_PER_DAY
1753
+ return m / MINUTES_PER_DAY
1756
1754
1757
1755
1758
1756
def hours (h ):
0 commit comments