Skip to main content

Graphene Pandas integration

Project description

Build Status Coverage Status

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


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 details)

Uploaded Source

Built Distribution

graphene_pandas-0.1.1-py2.py3-none-any.whl (5.9 kB view details)

Uploaded Python 2Python 3

File details

Details for the file graphene-pandas-0.1.1.tar.gz.

File metadata

  • Download URL: graphene-pandas-0.1.1.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.9.1

File hashes

Hashes for graphene-pandas-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9cba44fc85a729827ebecd4d53a0893fe5949b3c9deaa9c6bc2d98b1b88f1b9c
MD5 a4b744d9baefe237dd1e271827c6aab5
BLAKE2b-256 5b070c849b311eaecb883892b6e1c83ee04ea7f06c61bbace9d69c0d14886ff5

See more details on using hashes here.

File details

Details for the file graphene_pandas-0.1.1-py2.py3-none-any.whl.

File metadata

  • Download URL: graphene_pandas-0.1.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.9.1

File hashes

Hashes for graphene_pandas-0.1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 8ae042abb970bd314a76b9739b69895c1362a737c13e78655a52fd3afef65c41
MD5 6c65f81582d9589e74316da600e9ab81
BLAKE2b-256 8536b781df71c62f88220cd15c87c8e14fc70fc59d9201f38f973d6c27e8ca71

See more details on using hashes here.

Supported by

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