Last active
February 6, 2020 16:52
-
-
Save 8080labs/e3f1372f7b7cc8c8aa90bc4a6189084f to your computer and use it in GitHub Desktop.
plotly_histogram
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 plotly.graph_objs as go | |
def interactive_histogram(df, column_name): | |
series = df[column_name] | |
# Change size to anything you want in order to adjust the binwidth | |
trace = go.Histogram(x=series, xbins={"size": None}) | |
figure_widget = go.FigureWidget( | |
data=[trace], | |
layout=go.Layout( | |
yaxis={"title": "Count"}, | |
xaxis={"title": column_name}, | |
bargap=0.05, | |
) | |
) | |
return figure_widget | |
interactive_histogram(df, "arr_delay") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment