Graphene Pandas integration
Project description
graphene-pandas(under developing)
Installation
For instaling graphene-pandas, just run this command in your shell
pip3 install graphene-pandas(not implemented)
Examples
To create a GraphQL schema for it, you simply have to write the following:
import pandas as pd
import graphene
from graphene_pandas import DataFrameObjectType
data = {"Brand": ["Honda Civic", "Toyota Corolla", "Ford Focus", "Audi A4"],
"Price": [22000, 25000, 27000, 35000]}
df = pd.DataFrame(data)
class Records(DataFrameObjectType):
class Meta:
model = df
exclude_fields = ()
class Query(graphene.ObjectType):
record = graphene.Field(Records, index=graphene.Int())
records = graphene.List(Records)
def resolve_record(self, info, index):
query = Records.get_row_int_index(info, index)
return query
def resolve_records(self, info):
query = Records.get_all_rows(info)
return query
schema = graphene.Schema(query=Query)
query = """
query Test {
record(index: 1) {
Brand
Price
}
records {
Brand
Price
}
}
"""
result = graphene.schema.execute(query)
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
graphene-pandas-0.1.1.tar.gz
(4.6 kB
view hashes)
Built Distribution
Close
Hashes for graphene_pandas-0.1.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ae042abb970bd314a76b9739b69895c1362a737c13e78655a52fd3afef65c41 |
|
MD5 | 6c65f81582d9589e74316da600e9ab81 |
|
BLAKE2b-256 | 8536b781df71c62f88220cd15c87c8e14fc70fc59d9201f38f973d6c27e8ca71 |