BUG: User-facing AssertionError in Series.to_timestamp · Issue #33327 · pandas-dev/pandas (original) (raw)
- I have checked that this issue has not already been reported.
- I have confirmed this bug exists on the latest version of pandas.
- (optional) I have confirmed this bug exists on the master branch of pandas.
Code Sample, a copy-pastable example
In [5]: import pandas as pd
In [6]: pd.Series([0]).to_timestamp()
AssertionError Traceback (most recent call last) in ----> 1 pd.Series([0]).to_timestamp()
~/sandbox/pandas/pandas/core/series.py in to_timestamp(self, freq, how, copy) 4565 new_values = new_values.copy() 4566 -> 4567 assert isinstance(self.index, (ABCDatetimeIndex, ABCPeriodIndex)) 4568 new_index = self.index.to_timestamp(freq=freq, how=how) 4569 return self._constructor(new_values, index=new_index).finalize(
AssertionError:
Problem description
Users shouldn't see AssertionErrors like this, since they may be disabled when the interpreter starts up.
Expected Output
We probably want this to be a TypeError
.