Skip to main content

A simple static visualizer(I can make it dynamic though :)).

Project description

PyVisualizer_Task2

A simple static visualizer(I can make it dynamic though), Works as a wrapper around Gspread(version should be 3.0.1 or above) lib for reading the google sheets. https://pypi.org/project/PyVisualizer

Installation

pip install PyVisualizer

Points to keep in mind

You can access any Google sheet, if that google sheet is shared with this user

"new-service-acc@task-2-greendeck.iam.gserviceaccount.com"

. This is because test account has been registered to access a google service account and configured accordingly.

Overview

This lib has 3 parts
1 - Connect to the Google sheet by passing the service_account.json file path as a parameter
2 - After successfully connection, Read the Google sheet with the connection object and get the specified sheetobject in return.
3 - Once the data has been read successfully, Pass the data to pre-defined methods of Visualizer class for plotting.

QuickStart

1 - Import 2 classes of PyVisualizer package

CommonUtilities class holds 2 methods.
1 - connectAndAutorizeToServiceAccount() : This method accepts a service_account.json file path as a parameter and return clientConnectionObject.
2 - read_google_sheet() : This method accepts 3 parameters. clientConnectionObject, Google Sheet file name, Worksheet name. It returns sheetObject for access the data.
>>> from PyVisualizer.CommonUtilities import CommonUtilities
>>> from PyVisualizer.Visualizer import Visualizer

2 - Create a connection and read the data.

>>> commonUtils = CommonUtilities()
>>> connectionClient = commonUtils.connectAndAutorizeToServiceAccount("pass_the_service_account.json file path, you can download it from this repo /PyVisualizer/service_account.json.")
Successfully Authorized and Connected to Google Service Account. :)
>>> sheetObj = commonUtils.read_google_sheet(connectionClient,"Copy_of_Greendeck_SE_Assignment_Task_2","Sheet1") # 2nd parameter is the file name, which is already shared with test account
>>> sheet1_data = sheetObj.get_all_records() # This return the json array

3 - Converting the sheet data into pandas DataFrame and pass it to pre-defined methods

>>> import pandas as pd
>>> df = pd.DataFrame(sheet1_data)
>>> Visualizer().barPlotSalesByYear(pandasDataframe=df,xColName="timestamp",yColName="average_sales",sSaveWithFileName="salesByYear.png")
>>> Visualizer().barPlotSalesByMonth(pandasDataframe=df,xColName="timestamp",yColName="average_sales",sSaveWithFileName="salesByMonth.png")
>>> Visualizer().getSalesByYearsAndMonths(df)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

PyVisualizer-1.0.9.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

PyVisualizer-1.0.9-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file PyVisualizer-1.0.9.tar.gz.

File metadata

  • Download URL: PyVisualizer-1.0.9.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.6.0

File hashes

Hashes for PyVisualizer-1.0.9.tar.gz
Algorithm Hash digest
SHA256 773f462d0bd5f1d1234ad8630c5b25f0f8e965dbb9b0f9f3c9e787231045f2b4
MD5 5632b257c351e35e48e9779ff89de663
BLAKE2b-256 1c196618528a8c6e5cfeeb490f1331a0fa14dcea0b00f740c329f4d0d55c12f7

See more details on using hashes here.

File details

Details for the file PyVisualizer-1.0.9-py3-none-any.whl.

File metadata

  • Download URL: PyVisualizer-1.0.9-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.6.0

File hashes

Hashes for PyVisualizer-1.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 3f71102dcf9ab19d6291088c162d472db7bcd45076db05ed1de8099c188dedba
MD5 a836b67375a23c8dd08e56c659ecbe67
BLAKE2b-256 f59c29a41fdff87ee32a4c9370c6df8ad4fc822f68cd62061e0fc0e2492e3004

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page