0

DataFrame overview

Can someone help me how you would go around this and use the dates and the time to make visualisation for this? (for example time-brackets (9-12, 12-15, 15-18 and so on). Price against time. But since the format is kinda difficult I can't get the solution.

I tried this but it doesn't work (probably; because its a vector)

from datetime import datetime

date_time_obj = datetime.strptime(date_time_str, '%d/%m/%y %H:%M:%S')

print "The type of the date is now",  type(date_time_obj)

print "The date is", date_time_obj
FObersteiner
  • 22,500
  • 8
  • 42
  • 72
PeterPost
  • 1
  • 1
  • can you please provide a example with a code snippet instead of images? images should be included mainly to represent plots.. – adir abargil Jan 10 '21 at 11:57
  • Ok thanks! I would like to do smth like this but it doesn't work: – PeterPost Jan 10 '21 at 12:03
  • from datetime import datetime date_time_obj = datetime.strptime(date_time_str, '%d/%m/%y %H:%M:%S') print "The type of the date is now", type(date_time_obj) print "The date is", date_time_obj – PeterPost Jan 10 '21 at 12:03
  • 1
    you can look at this to understand what i mean :https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples – adir abargil Jan 10 '21 at 12:05

1 Answers1

0
import datetime

date_time_str = str(datetime.datetime.now())
print('date_time_str',date_time_str)

date_time_obj = datetime.datetime.strptime(date_time_str, '%Y-%m-%d %H:%M:%S.%f')

print('Date:', date_time_obj.date())
print('Time:', date_time_obj.time())
print('Date-time:', date_time_obj)
ZealousWeb
  • 1,647
  • 1
  • 10
  • 11