Coding skills here for learning
5 subscribers
266 photos
3 files
10 links
Download Telegram
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
def split_brand(brand_name_data):
return brand_name_data.split(' ')[-1]


user_df['brand_name'] = user_df.brand_info.apply(split_brand)




defining the function then applying it on the new column with existing column
user_df['brand_name'] = user_df.brand_info.apply(lambda brand_name: brand_name.split(' ')[-1]) with lambda applying
users_purchases = users_purchases.query('purchases >= 5') for querying
.agg({'brand_name': pd.Series.nunique}) finding out the unique value
users_purchases \
.merge(users_unique_brands, on='user_id') \
.merge(lovely_brand_purchases_df, on='user_id')

for merge purposes with primary key
ax = sns.barplot(x="lovely_brand", y="user_id", data=brands_loyalty) barplot
dropna() for dropping null values
df[
~(df['workingday'] == 0)
&(df['temp'] >= 10)
&(df['temp'] < 30)
] with working filtering
pd.set_option('display.max_rows', 85, index_col ="Column") for showing out the all indexes in table
df['ConvertedCp'].nlargest() finding out the max()
df.sort_values(by=['Country', 'ConvertedCp,'], ascending=[True, False], inplace = True) sorting advanced
df.drop(index = 4)

deleting with index
country_grp['Salary'].median().loc['Germany'] Germany country looking for the Salary
country_uses_python = country_grp['LanguageWorkedWith'].apply(lambda x: x.str.contains('Python').sum())

where Python word contains
df.columns = df.columns.str.replace('', '_')
df.columns = [x.upper() for x in df.columns]