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 typing import Any | |
import pandas as pd | |
import plotly.graph_objects as go | |
import pandas as pd | |
def barchart( | |
df: pd.DataFrame, x_col: str, y_col: str, | |
title: str | None = None, |
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
nimport numpy as np | |
import pandas as pd | |
import sys | |
import plotly.graph_objects as go | |
from plotly.subplots import make_subplots | |
import plotly | |
import plotly.express as px | |
import matplotlib.pyplot as plt |
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 plotly.graph_objects as go | |
import plotly.offline as pyo | |
import pandas as pd | |
import argparse | |
import sys | |
def parse_arguments(args): |
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
""" | |
`plotly.express` is a terse, consistent, high-level wrapper around `plotly.graph_objects` | |
for rapid data exploration and figure generation. Learn more at https://plotly.express/ | |
""" | |
from __future__ import absolute_import | |
from plotly import optional_imports | |
pd = optional_imports.get_module("pandas") | |
if pd is None: | |
raise ImportError( |
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 pandas as pd | |
import numpy as np | |
import time | |
url = "http://archive.ics.uci.edu/ml/machine-learning-databases/mammographic-masses/mammographic_masses.data" | |
names = ['BI-RADS', 'Age', 'Shape', 'Margin', 'Density', 'Severity'] | |
def manual_convert(): | |
df = pd.read_csv(url, names=names) |
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 pandas as pd | |
import plotly.graph_objects as go | |
df = pd.read_csv("https://raw.githubusercontent.com/plotly/datasets/master/2014_world_gdp_with_codes.csv") | |
df = df.sort_values(by='GDP (BILLIONS)', ascending=False).head(10) | |
fig = go.Figure([go.Bar(x=list(range(len(df))), y=df['GDP (BILLIONS)'])]) | |
fig.update_xaxes(tickmode = 'array', |
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 as np | |
import matplotlib.pyplot as plt | |
import plotly.graph_objects as go | |
women_pop = np.array([5., 30., 45., 22.]) | |
men_pop = np.array( [5., 25., 50., 20.]) | |
y = list(range(len(women_pop))) | |
fig = go.Figure(data=[ | |
go.Bar(y=y, x=women_pop, orientation='h', name="women", base=0), |
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 statsmodels.tsa.seasonal import seasonal_decompose | |
import plotly.tools as tls | |
def plotSeasonalDecompose( | |
x, | |
model='additive', | |
filt=None, | |
period=None, | |
two_sided=True, | |
extrapolate_trend=0, |
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 networkx as nx | |
import pandas as pd | |
import numpy as np | |
import matplotlib.pyplot as plt | |
# Multigraph example | |
G = nx.MultiGraph() | |
G.add_nodes_from([1, 2, 3]) |
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 as np | |
""" | |
Implements Sequential probability ratio test | |
https://en.wikipedia.org/wiki/Sequential_probability_ratio_test | |
""" | |
class SPRT: | |
def __init__(self, alpha, beta, mu0, mu1): |
NewerOlder