0

I've got a value that is of the type:

'pandas._libs.tslibs.timestamps.Timestamp'

but I want to convert it into:

'int'

Simply using int() doesn't work and gives me the following error message:

int() argument must be a string, a bytes-like object or a number, not 'Timestamp'

Edit: to be clear, I only want the type to change to integral. However I want the number to stay the same.

  • Does this answer your question? [pandas convert from datetime to integer timestamp](https://stackoverflow.com/questions/54312802/pandas-convert-from-datetime-to-integer-timestamp) – Chris Apr 16 '22 at 14:19
  • Unfortunately not. If I try to do this, my timeframe value will convert to a different integral number. For reference it goes from 15478 to 741398400000000000. What I want is just that this value get's converted to an integral number, but the number itself doesn't change. – Brockenspook Apr 16 '22 at 17:09

1 Answers1

0

You should use the class (pandas._libs.tslibs.timestamps.Timestamp) methods. pandas._libs.tslibs.timestamps.Timestamp.timestamp() returns the timestamp, however it is a float instead of an int.

Marco Balo
  • 336
  • 2
  • 9
  • I'm missing something I'm afraid. I'm pretty new to Python just typing this out in either in this way: x.pandas._libs.tslibs.timestamps.Timestamp.timestamp() or this way: pandas._libs.tslibs.timestamps.Timestamp.timestamp(x) gives new error messages. – Brockenspook Apr 16 '22 at 17:16