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
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
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['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.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
rents_by_week = df_1.groupby(
df_1['datetime'].dt.weekofyear
).agg({
'temp': 'count'
})
# sample(10) - это взять 10 случайных записей
# Чтобы была воспроизводимость, фиксируем random_state
rents_by_week.sample(10, random_state=42)
df_1['datetime'].dt.weekofyear
).agg({
'temp': 'count'
})
# sample(10) - это взять 10 случайных записей
# Чтобы была воспроизводимость, фиксируем random_state
rents_by_week.sample(10, random_state=42)
df_1['datetime'].dt.dayofyear day of year finding out the day