-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Closed
Labels
Error ReportingIncorrect or improved errors from pandasIncorrect or improved errors from pandasNumeric OperationsArithmetic, Comparison, and Logical operationsArithmetic, Comparison, and Logical operationsPeriodPeriod data typePeriod data type
Milestone
Description
Right now, some of the error messages for in pandas/tseries/period.py are not so great:
In [9]: period = Period('2000-01-03', 'B')
In [10]: period > 1
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-10-df287da31a9f> in <module>()
----> 1 period > 1
/pandas/tseries/period.pyc in f(self, other)
172 return func(self.ordinal, other.ordinal)
173 else:
--> 174 raise TypeError(other)
175
176 f.__name__ = name
TypeError: 1
And in the case above, should really return NotImplemented
instead (so that they end up with an error message like):
----> 1 1 + period
TypeError: unsupported operand type(s) for +: 'int' and 'Period'
Side note - that's only appropriate these are only used as magic methods (so that the Python interpreter converts them into the TypeError shown above...).
Metadata
Metadata
Assignees
Labels
Error ReportingIncorrect or improved errors from pandasIncorrect or improved errors from pandasNumeric OperationsArithmetic, Comparison, and Logical operationsArithmetic, Comparison, and Logical operationsPeriodPeriod data typePeriod data type