This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resampled_df_m = df_no_refund.resample('M', on='Date').sum().reset_index() | |
treemap2_df = resampled_df_m.copy() | |
treemap2_df['treeroot'] = 'Monthly Expense' | |
treemap2_df['Month'] = treemap2_df.Date.dt.month_name() | |
fig = px.treemap( | |
treemap2_df, | |
path=['treeroot', 'Month'], | |
values = 'Total', | |
title = 'Distribution of Steam Spending by Month', | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
if not os.path.exists("images"): | |
os.mkdir("images") | |
import plotly.express as px | |
import plotly.io as pio | |
pio.kaleido.scope.default_format = "png" | |
pio.kaleido.scope.default_width = "1024" | |
pio.kaleido.scope.default_height = "768" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resampled_df_m = df_no_refund.resample('M', on='Date').sum().reset_index() | |
import matplotlib.pyplot as plt | |
import seaborn as sns | |
sns.set_context('poster') | |
sns.set_style("darkgrid") | |
plt.figure(figsize = (16, 8)) | |
ax = sns.barplot(data = resampled_df_m, x="Date", y="Total") | |
ax.set_xticklabels(resampled_df_m.Date.dt.month_name()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
#Create dataframe from columns | |
Dict = {"Date": wht_date, "Items": wht_items, "Type": wht_type, "Total": wht_total} | |
df = pd.DataFrame.from_dict(Dict) | |
df.Date = pd.to_datetime(df.Date, infer_datetime_format=True) | |
df_no_refund = df[:-2] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
wht_date = soup.select(".wht_date") | |
wht_date = [each.get_text() for each in wht_date[1:]] | |
wht_items = soup.select(".wht_items") | |
wht_items = [each.get_text().replace("\n", "_").replace("\t", "") for each in wht_items[1:]] | |
wht_type = soup.select(".wht_type") | |
wht_type = [each.get_text().replace("\n", "_").replace("\t", "") for each in wht_type[1:]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bs4 import BeautifulSoup | |
soup = BeautifulSoup(open("your_file.html", encoding = 'utf8'), "html.parser") |