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
df = df.rename(columns={'Номер': 'number',
'Дата создания': 'create_date',
'Дата оплаты': 'payment_date',
'Title': 'tittle',
'Статус': 'status',
'Заработано': 'money',
'Город': 'city',
'Платежная система': 'payment_system'})
all_money = df.money.sum()
renaming columns
'Дата создания': 'create_date',
'Дата оплаты': 'payment_date',
'Title': 'tittle',
'Статус': 'status',
'Заработано': 'money',
'Город': 'city',
'Платежная система': 'payment_system'})
all_money = df.money.sum()
renaming columns
money_title = df \
.query("status == 'Завершен'") \
.groupby(['tittle'], as_index=False) \
.aggregate({'money': 'sum', 'number': 'count'}) \
.sort_values('money', ascending=False) \
.rename(columns={'number': 'success_orders'})
today_day = datetime.today().strftime('%Y-%m-%d')
strftime()
.query("status == 'Завершен'") \
.groupby(['tittle'], as_index=False) \
.aggregate({'money': 'sum', 'number': 'count'}) \
.sort_values('money', ascending=False) \
.rename(columns={'number': 'success_orders'})
today_day = datetime.today().strftime('%Y-%m-%d')
strftime()
print(money_by_city.equals(money_by_city2)) equals will make comparsion
pd.read_csv(file_path2, encoding='windows-1251', index_col=0, usecols=['tc', 'art_sp'])
using usecols and index_col for more appropriate way of using
using usecols and index_col for more appropriate way of using