'Not able to see all the methods under dt accessor in Jupyter notebook

Maybe a silly question. I have been trying to use dt accessor in pandas to use datetime methods on certain date fields in my Data Frame.

Not sure why, but the after putting 'dt' accessor, Jupyter does not provide the list of methods available for use on a click of Tab button.

Jupyter does not provide methods supported by dt accessor

Things already tried:

  1. Imported datetime library (Don't know why i felt it may fix the problem)
  2. Searched Stackoverflow for an answer to this. Could not find one.
  3. Checked the type of the column on which i am using the dt accessor. It is indeed a 'timestamp' object. See image below

'timestamp' object



Solution 1:[1]

'dt' accessor only works and only is shown in Series that are datetime.

You should check the dateframe type as best practice, with:

raw_data.dtypes

In case you need to update Serie, you can do in this way:

raw_data['PAYMENT_DATE'] =  pd.to_datetime(raw_data['PAYMENT_DATE'])

'dt' accessor should be shown now.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 jpg997