Giter VIP home page Giter VIP logo

gslides's Introduction

gslides: Creating charts in Google slides

gslides is a Python package that helps analysts turn pandas dataframes into Google slides & sheets charts by configuring and executing Google API calls.

The package provides a set of classes that enable the user full control over the creation of new visualizations through configurable parameters while eliminating the complexity of working directly with the Google API.

Quick Installation

pip install gslides

Usage

Below is an example that only showcases a simple workflow. Full discussion around features can be found in the docs.

1. Initialize package and connection

import gslides
from gslides import (
    Frame,
    Presentation,
    Spreadsheet,
    Table,
    Series, Chart
)
from sklearn import datasets
gslides.initialize_credentials(creds) #BringYourOwnCredentials

2. Create a presentation

prs = Presentation.create(name = 'demo pres')

3. Create a spreadsheet

spr = Spreadsheet.create(
    title = 'demo spreadsheet',
    sheet_names = ['demo sheet']
)

4. Load the data to the spreadsheet

plt_df = #Iris data
frame = Frame.create(df = plt_df,
          spreadsheet_id = spr.spreadsheet_id,
          sheet_id = spr.sheet_names['demo sheet'],
          sheet_name = 'demo sheet',
          overwrite_data = True
)

5. Create a scatterplot

sc = Series.scatter(series_columns = target_names)
ch = Chart(
    data = frame.data,
    x_axis_column = 'sepal length (cm)',
    series = [sc],
    title = f'Demo Chart',
    x_axis_label = 'Sepal Length',
    y_axis_label = 'Petal Width',
    legend_position = 'RIGHT_LEGEND',
)

6. Create a table

tbl = Table(
    data = plt_df.head()
)

7. Create a slide with the scatterplot

prs.add_slide(
  objects = [ch, tbl],
  layout = (1,2),
  title = "Investigation into Fischer's Iris dataset",
  notes = "Data from 1936"
)

8. Preview the slide you have just created in your notebook

prs.show_slide(prs.slide_ids[-1])

img/usage.png

gslides also supports basic templating functionality. See this notebook for an example.

Advanced Usage

Find this Jupyter notebook detailing advanced usage of gslides.

Developer Instructions

To install the package with development dependencies run the command

pip install -e .[dev]

This will enable the following

  • Unit testing using pytest - Run pytest in root package directory
  • Pre commit hooks ensuring codes style using black and isort
  • Sphinx documentation - To create sphinx run make html in package docs folder - To view locally run python -m http.server

gslides's People

Contributors

michael-gracie avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.