Read/write gspread worksheets using pandas DataFrames
Project description
gspread-dataframe
If you have pandas (>= 0.14.0) installed, the gspread_dataframe module offers get_as_dataframe and set_with_dataframe functions to return a worksheet’s contents as a DataFrame object, or set a worksheet’s contents using a DataFrame.
import pandas as pd
from gspread_dataframe import get_as_dataframe, set_with_dataframe
worksheet = some_worksheet_obtained_from_gspread_client
df = pd.DataFrame.from_records([{'a': i, 'b': i * 2} for i in range(100)])
set_with_dataframe(worksheet, df)
df2 = get_as_dataframe(worksheet)
The get_as_dataframe function supports the keyword arguments that are supported by your Pandas version’s text parsing readers, such as pandas.read_csv. Consult your Pandas documentation for a full list of options; since the 'python' engine in Pandas is used for parsing, only options supported by that engine are acceptable:
import pandas as pd
from gspread_dataframe import get_as_dataframe
worksheet = some_worksheet_obtained_from_gspread_client
df = get_as_dataframe(worksheet, parse_dates=True, usecols=[0,2], skiprows=1, header=None)
Installation
Requirements
Python 2.6+ and Python 3.2+
gspread (>=3.0.0; to use older versions of gspread, use gspread-dataframe releases of 2.1.1 or earlier)
Pandas >= 0.14.0
From PyPI
pip install gspread-dataframe
From GitHub
git clone https://github.com/robin900/gspread-dataframe.git
cd gspread-dataframe
python setup.py install
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for gspread_dataframe-3.0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7111ea38a9436a92fc52c16ed54245fb3b7141e9bcbc31db7ff7b53e545adb32 |
|
MD5 | b8b7be37fe3fd9195d0961af83784b66 |
|
BLAKE2b-256 | fa1b6737cfb45e51ca23762432bc6af0837e4708eda33f5f8f92a72281fec0fd |