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
| 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
| 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
| 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
| # impor spark, set spark context | |
| from pyspark import SparkContext, SparkConf | |
| from pyspark.sql.context import SQLContext | |
| import sys | |
| import os | |
| if len(sys.argv) == 1: | |
| sys.stderr.write("Must enter input file to convert") | |
| sys.exit() | |
| input_file = sys.argv[1] |
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 sys | |
| import time | |
| import boto3 | |
| def lambda_handler(event, context): | |
| conn = boto3.client("emr") | |
| # chooses the first cluster which is Running or Waiting | |
| # possibly can also choose by name or already have the cluster id | |
| clusters = conn.list_clusters() |
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
| 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', |
NewerOlder