Skip to content

Instantly share code, notes, and snippets.

books.groupby('authors')[['ratings_count','average_rating']].describe()
books[books['authors'] == 'J.K. Rowling-Mary GrandPré']
values = books[books['authors'] == 'J.K. Rowling-Mary GrandPré']['average_rating'].values
values
sum(values)/len(values)
books[books['authors'] == 'J.K. Rowling-Mary GrandPré']['average_rating'].mean()
books['average_rating'].mean()
grouped_df = books.groupby('authors').mean()
grouped_df.loc['A.M. Homes']
books.groupby('authors',as_index=False).mean()
books.groupby('authors').mean().reset_index()
@axmakarov
axmakarov / 2016-06-01 Metrika API New User Params 02
Last active September 18, 2019 14:41
Yandex.Metrika API request for getting visits data of users with specific first visit date
https://beta.api-metrika.yandex.ru/stat/v1/data?dimensions=ym:s:specialUser,ym:s:dateTime,ym:s:lastTrafficSource,ym:s:lastSourceEngine&metrics=ym:s:visits,ym:s:avgDaysSinceFirstVisit&date1=2016-05-01&date2=2016-05-31&ids=<id>&oauth_token=<token>&limit=100000&offset=1&filters=EXISTS(ym:u:userFirstVisitDate=='2016-05-13')