API: change Timestamp.strptime to raise NotImplementedError by saurav2608 · Pull Request #25124 · pandas-dev/pandas (original) (raw)

I did some investigations on local. I am following the idea given by @mroeschke (swap the assignments and the position in constructor). It solves the bug associated with strptime. But it changes Timestamp API that seems unnatural. Can we discuss this point?

The below code give 2 natural (for me) ways to construct a Timestamp. One works and one does not.

In [45]: pd.Timestamp(year=2000, month=1, day=2, hour=3, minute=4, second=5, microsecond=6, nanosecond=1, tz='UTC')                                                               
Out[45]: Timestamp('2000-01-02 03:04:05.000006001+0000', tz='UTC')

In [46]: pd.Timestamp(2000, 1, 2, 3, 4, 5, 6, 1, 'UTC')                                                                                                                           
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-46-f9dc555e86e9> in <module>
----> 1 pd.Timestamp(2000, 1, 2, 3, 4, 5, 6, 1, 'UTC')

~/Documents/Projects/pandas-saurav/pandas/_libs/tslibs/timestamps.pyx in pandas._libs.tslibs.timestamps.Timestamp.__new__()
    750                           " tz_convert instead.", FutureWarning)
    751 
--> 752         ts = convert_to_tsobject(ts_input, tz, unit, 0, 0, nanosecond or 0)
    753 
    754         if ts.value == NPY_NAT:

TypeError: an integer is required