0

capture yesterday's date:

yesterday = datetime.date.fromordinal(datetime.date.today().toordinal()-1).strftime("%F")

This gives me:

yesterday
'2018-03-15'

type(yesterday)
str

Create dataframe with data from query

df = as_pandas(cursor) 

This gives me:

df 
  datestring    hourstring  countstring
    2018-01-14        10    299
    2018-01-15        08    4682
    2018-01-15        09    406
    2018-01-16        05    3359
    2018-01-16        06    11926
    2018-01-16        07    42602  

type(df)
pandas.core.frame.DataFrame

type(df.datestring)
pandas.core.series.Series

How do I use the variable "yesterday" to select only the rows where the datestring = "yesterday"?

cs95
  • 379,657
  • 97
  • 704
  • 746
sectechguy
  • 2,037
  • 4
  • 28
  • 61

0 Answers0