diff --git a/notebooks/Explore Movie Dataset.html b/notebooks/Explore Movie Dataset.html new file mode 100644 index 0000000..3cc537b --- /dev/null +++ b/notebooks/Explore Movie Dataset.html @@ -0,0 +1,721 @@ + +
import os
+import pandas as pd
+import settings
+import etl
+
+%matplotlib inline
+
+%load_ext watermark
+%watermark -d -t -v -m -p pea,pandas
+data = etl.Data()
+data.load()
+data.movie.columns
+This example is using my own branch of IPlotter which builds the dictionary from a pandas DataFrame. Much less verbose, but can be done with the current version on PyPI.
+ +from iplotter import C3Plotter
+c3 = C3Plotter()
+plot_data = data.movie.groupby(['title_year']).mean()[['gross']].fillna(0)
+c3.plot(plot_data, zoom=True)
+country_group = data.movie.groupby('country').count()['duration']
+counts = country_group.values.tolist()
+countries = country_group.index.values.tolist()
+from iplotter import PlotlyPlotter
+from IPython.display import HTML
+
+plotly = PlotlyPlotter()
+
+c3_plotter = C3Plotter()
+
+plotly_chart = [{
+ "type": 'choropleth',
+ "locationmode": 'country names',
+ "locations": countries,
+ "z": counts,
+ "zmin": 0,
+ "zmax": max(counts),
+ "colorscale": [
+ [0, 'rgb(242,240,247)'], [0.2, 'rgb(218,218,235)'],
+ [0.4, 'rgb(188,189,220)'], [0.6, 'rgb(158,154,200)'],
+ [0.8, 'rgb(117,107,177)'], [1, 'rgb(84,39,143)']
+ ],
+ "colorbar": {
+ "title": 'Count',
+ "thickness": 10
+ },
+ "marker": {
+ "line": {
+ "color": 'rgb(255,255,255)',
+ "width": 2
+ }
+ }
+}]
+
+plotly_layout = {
+ "title": 'Movie Counts by Country',
+ "geo": {
+ "scope": 'country names',
+ }
+}
+
+
+
+country_plot = plotly.plot(data=plotly_chart)
+
+