Coding skills here for learning
6 subscribers
266 photos
3 files
10 links
Download Telegram
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
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)
ax = rents_by_week.hist(bins=100, figsize=(16, 9))
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
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()
pd.read_csv(file_path, encoding='windows-1251' , sep=';')
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