@@ -27,27 +27,27 @@ Example Usage
2727 creative = creatives[0 ]
2828 creative.title = ' shiny new title'
2929 # the session is inherited from `atomx` that made the get request
30- creative.update ()
30+ creative.save ()
3131
3232
3333 # create a new profile
3434 from atomx.models import Profile
3535 profile = Profile(advertiser_id = 23 , name = ' test profile' )
36- # Note that you have to pass it a valid `Atomx` session for save
37- # or use `atomx.save (profile)`
38- profile.save (atomx)
36+ # Note that you have to pass it a valid `Atomx` session for create
37+ # or use `atomx.create (profile)`
38+ profile.create (atomx)
3939
4040 # now you could alter and update it like the creative above
4141 profile.name = ' changed name'
42- profile.update ()
42+ profile.save ()
4343
4444
4545 # you can also get attributes
4646 profiles = atomx.get(' advertiser/88/profiles' )
4747 # profiles is now a list of `atomx.models.Profile` that you can
4848 # read, update, etc again.
4949 profiles[0 ].click_frequency_cap_per = 86400
50- profiles[0 ].update ()
50+ profiles[0 ].save ()
5151
5252
5353 # working with search
@@ -62,17 +62,17 @@ Example Usage
6262
6363 # reporting example
6464 # get a report for a specific publisher
65- report = atomx.report(type = ' publisher' , sums = [' impressions ' , ' clicks ' ], groups = [ ' hour ' ], where = [[' publisher_id' , ' ==' , 42 ]], from_ = ' 2015-02-08 00:00:00' , to = ' 2015-02-09 00:00:00' , timezone = ' America/Los_Angeles' )
65+ report = atomx.report(scope = ' publisher' , groups = [' hour_formatted ' ], sums = [ ' impressions ' , ' clicks ' ], where = [[' publisher_id' , ' ==' , 42 ]], from_ = ' 2015-02-08 00:00:00' , to = ' 2015-02-09 00:00:00' , timezone = ' America/Los_Angeles' )
6666 # check if report is ready
6767 print (report.is_ready)
6868 # if pandas is installed you can get the pandas dataframe with `report.pandas`
6969 # you can also get the report csv in `report.content` without pandas
7070 df = report.pandas
7171 # set index to datetime
7272 import pandas as pd
73- df.index = pd.to_datetime(df.pop(' hour ' ))
74- # resample per day
75- means = df.resample(' D ' , how = [' mean' , ' median' , ' std' ])
73+ df.index = pd.to_datetime(df.pop(' hour_formatted ' ))
74+ # calculate mean, median, std per hour
75+ means = df.resample(' H ' , how = [' mean' , ' median' , ' std' ])
7676 # and plot impression and clicks per day
7777 means[' impressions' ].plot()
7878 means[' clicks' ].plot()
0 commit comments