Coding skills here for learning
5 subscribers
266 photos
3 files
10 links
Download Telegram
ads_data.groupby('date') \
.agg({'ad_id': 'count'}).plot()

using groupby and aggregating and ploting
ads_data.groupby(['date', 'event'], as_index=False) \
.agg({'ad_id': 'count'}) \
.pivot(index='date', columns='event', values='ad_id')\
.reset_index()


using groupby and pivoting by date and event and ad_id
ads_data[ads_data.date == '2019-04-05'] \
.groupby('ad_id') \
.agg({'time': 'count'}) \
.sort_values('time', ascending=False) \
.head()

specifiying time and aggregating and sorting out the value time
ads_data.query('ad_id == @ad_id').head(1) with query you will find out the this one
.pivot(index='ad_id', columns='event', values='time').reset_index() this with reset_index helps to start index by again
ads_data_by_ad.assign(ctr = ads_data_by_ad.click / ads_data_by_ad.view,
ctr_per = 100 * ads_data_by_ad.click / ads_data_by_ad.view)

when there is 2 variables and you are assinging that in one table new variables aare in here
ads_data_by_ad.query('view == 0').ad_id finding out the missing column
ads_data[ads_data.ad_id.isin(ads_ids_bug)] finding out the wrong things
ads_data[ads_data.ad_id == 16548].sort_values('time') sorting out with time
okay download the dataset work with unproper columns like convert them or with usecols you can filter out in the begining then work with isnull values then find out what we need and use groupby query agg and use why not debugs then quantiles after finding out the problem issue we will look at the only data that we need and find out the root cause
columns[1:5] finding out the spliting column
df[df['workingday'] == 0] filtering where we need the workingday filtered
df[
(df['workingday'] == 1) & (df['season'] == 1)
]
working with two filters

and using ~
df[df['windspeed'].isna()] specifically finding out by column that there is a null value
df['workingday'].isna().any() assuring that
df[df['season'].isin([1, 3, 4])]
df.loc[4]['temp'] with column temp secondary and firstly using their index
df.copy().set_index('datetime') setting index as column in a index column
groupby(['season', 'workingday'])['humidity'].mean() with extra condition
df_1[df_1['datetime'].dt.month == 5] month extraction