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
# Bar chart | |
def plot_data(data): | |
data['Count'] = 1 | |
plot_data = data[['amount','currency','Count']] | |
plot_data = plot_data.groupby(["currency"],as_index=False).Count.sum() | |
with chart_output: | |
print("Total data: ", len(data)) | |
plot_bar(plot_data, x="currency", y="Count", color="currency") |
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
def filter_data(data): | |
# Creating Dropdowns and buttons | |
dropdown_currency = widgets.Dropdown(options=data.currency.unique(), description='Currency:') | |
# Event handler for dropdowns | |
def dropdown_currency_eventhandler(change): | |
common_filtering(data, change.new) | |
#Call |
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
# Only keep transactions where amount is < 1000 | |
data = data[data.amount < 1000] | |
with data_process_output: | |
print(f"Processed a total of {len(data)} transactions.") |
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
# Load existing vectorizer/model to make predictions | |
count_vectorizer = joblib.load("../supplementary/count_vectorizer") | |
data_ = data["Message"].tolist() | |
x_test = count_vectorizer.transform(data_) | |
model = joblib.load("../supplementary/game_classifier") | |
y_predicted = model.predict(x_test) | |
with data_process_output: | |
print(f"Predicted total {len(y_predicted)} values... Done.") |
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
# Upload file and Upload button | |
upload_btn_output = widgets.Output() | |
display(upload_btn_output) |
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
#Event handler for upload button | |
def upload_btn_eventhandler(obj): | |
#Clear output before each run | |
with data_process_output: | |
clear_output() | |
#Read file | |
for file_name in upload_file.value: | |
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
# Imports | |
import ipywidgets as widgets | |
# Buttons | |
upload_file = widgets.FileUpload(multiple=False) | |
upload_btn = widgets.Button(description="Upload and Predict", icon='check', button_style='success') | |
upload_btn.on_click(upload_btn_eventhandler) | |
input_widgets = widgets.HBox([upload_file, upload_btn]) | |
with upload_btn_output: | |
display(input_widgets) |
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 Library | |
import folium | |
import pandas as pd | |
from folium.plugins import MarkerCluster | |
#Load Data | |
data = pd.read_excel("tesla-supercharger-france.xlsx") | |
latitude = data['Ylatitude'] | |
longitude = data['Xlongitude'] | |
station = data['n_station'] |
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 Library | |
import folium | |
import pandas as pd | |
#Load Data | |
data = pd.read_excel("tesla-supercharger-france.xlsx") | |
latitude = data['Ylatitude'] | |
longitude = data['Xlongitude'] | |
station = data['ad_station'] |
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 Library | |
import folium | |
import pandas as pd | |
#Load Data | |
data = pd.read_excel("tesla-supercharger-france.xlsx") | |
latitude = data['Ylatitude'] | |
longitude = data['Xlongitude'] | |
station = data['ad_station'] |
NewerOlder