How to create the timestamp object with pandas in Python

4 Answers

0 votes
import pandas as pd 
  
ts = pd.Timestamp(year = 2020,  month = 5, day = 15, 
                  hour = 13, minute = 32, second = 20, tz = 'US/Central') 
  
print(ts) 
  
  
  
'''
run:
  
2020-05-15 13:32:20-05:00
      

 



answered May 15, 2020 by avibootz
0 votes
import pandas as pd 
  
ts = pd.Timestamp('2020-05-15T17:08') 
  
print(ts) 
  
  
  
'''
run:
  
2020-05-15 17:08:00
                
'''

 



answered May 15, 2020 by avibootz
0 votes
import pandas as pd 
  
ts = pd.Timestamp(1679899365.5, unit='s') 
  
print(ts) 
  
  
  
'''
run:
  
2023-03-27 06:42:45.500000
                
'''

 



answered May 15, 2020 by avibootz
0 votes
import pandas as pd 
  
ts = pd.Timestamp(1679899365.5, unit='s', tz='US/Pacific') 
  
print(ts) 
  
  
  
'''
run:
  
2023-03-26 23:42:45.500000-07:00
                
'''

 



answered May 15, 2020 by avibootz

Related questions

1 answer 177 views
1 answer 205 views
1 answer 241 views
1 answer 227 views
1 answer 182 views
1 answer 168 views
168 views asked Jan 1, 2021 by avibootz
...