This file contains hidden or 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 xml.etree.ElementTree as ET | |
import json | |
def parse_element(element, namespace, indent=""): | |
result = {} | |
if element.attrib: | |
result['attributes'] = element.attrib | |
if element.text and element.text.strip(): |
This file contains hidden or 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 numpy | |
import pandas | |
import matplotlib.pyplot as plt | |
import seaborn as sns | |
from ggplot import * | |
plt.style.use('ggplot') | |
def get_histogram_xy(data, bins=10): | |
"""Returns x,y coordinates for Histogram data. |
This file contains hidden or 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
""" | |
python3 | |
numpy>=1.12.0 | |
pandas>=0.19.2 | |
matplotlib>=2.0.0 | |
sklearn>=0.18 | |
xgboost>=0.6 | |
sortedcontainers>=1.5.7 | |
""" |
This file contains hidden or 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 plot_categorical_variables_pie(data, column_name, plot_defaulter = True, hole = 0): | |
''' | |
Function to plot categorical variables Pie Plots | |
Inputs: | |
data: DataFrame | |
The DataFrame from which to plot | |
column_name: str | |
Column's name whose distribution is to be plotted | |
plot_defaulter: bool |
This file contains hidden or 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 seaborn as sns | |
from sklearn import preprocessing, ensemble | |
from scipy.stats import kendalltau | |
import pandas as pd | |
import random | |
#todo change module name | |
from tqdm import tqdm | |
import numpy as np | |
import pandas as pd |
This file contains hidden or 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 plot_categorical(df: pd.DataFrame , col:str): | |
""" | |
Function to plot the categorical data on piechart using Plotly | |
@Args: | |
df: pandas data frame | |
col: A string column name within pandas data frame to plot | |
Return: | |
No object return, only visualization | |
""" |
This file contains hidden or 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
# Function to print digits on top of Barplot | |
def show_values(axs, orient="v", space=.01): | |
def _single(ax): | |
if orient == "v": | |
for p in ax.patches: | |
_x = p.get_x() + p.get_width() / 2 | |
_y = p.get_y() + p.get_height() + (p.get_height()*0.01) | |
value = '{:.2f}'.format(p.get_height()) | |
ax.text(_x, _y, value, ha="center") | |
elif orient == "h": |
This file contains hidden or 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
res_dim = 1024 | |
if __name__ == "__main__": | |
"""loading the data, | |
reading the file annotations, | |
appending the tabular coordinates to formulate a dataframe | |
""" | |
df_org = pd.DataFrame() | |
directory = '/content/drive/MyDrive/data_cs2' | |
final_col_directory = '/content/drive/MyDrive/cs2_col' |
This file contains hidden or 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 sklearn.datasets import load_wine | |
import pandas as pd | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import seaborn as sns | |
data = pd.DataFrame(load_wine()["data"],columns=load_wine()["feature_names"]) | |
data.head() |
This file contains hidden or 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
#Canvas | |
fig,ax = plt.subplots(1,1,figsize=(13,7.5),dpi=100) | |
#Chart | |
ax.plot(x,y,color=palette["primary_chart"], | |
zorder=2) | |
ax.scatter(x,y,color=palette["background"], | |
edgecolor=palette["primary"], | |
s=90, | |
zorder=3) |
NewerOlder