Skip to main content

ODPS Python SDK and data analysis framework

Project description

PyPI version Docs License Implementation

Elegent way to access ODPS API. Documentation

Installation

The quick way:

pip install 'pyodps[full]'

If you don’t need to use Jupyter, just type

pip install pyodps

The dependencies will be installed automatically.

Or from source code:

$ virtualenv pyodps_env
$ source pyodps_env/bin/activate
$ git clone <git clone URL> pyodps
$ cd pyodps
$ python setup.py install

Dependencies

  • Python (>=2.6), including Python 3+, pypy, Python 2.7 recommended

  • setuptools (>=3.0)

  • requests (>=2.4.0)

Run Unittest

  • copy conf/test.conf.template to odps/tests/test.conf, and fill it with your account

  • run python -m unittest discover

Usage

>>> from odps import ODPS
>>> o = ODPS('**your-access-id**', '**your-secret-access-key**',
...          project='**your-project**', endpoint='**your-end-point**')
>>> dual = o.get_table('dual')
>>> dual.name
'dual'
>>> dual.schema
odps.Schema {
  c_int_a                 bigint
  c_int_b                 bigint
  c_double_a              double
  c_double_b              double
  c_string_a              string
  c_string_b              string
  c_bool_a                boolean
  c_bool_b                boolean
  c_datetime_a            datetime
  c_datetime_b            datetime
}
>>> dual.creation_time
datetime.datetime(2014, 6, 6, 13, 28, 24)
>>> dual.is_virtual_view
False
>>> dual.size
448
>>> dual.schema.columns
[<column c_int_a, type bigint>,
 <column c_int_b, type bigint>,
 <column c_double_a, type double>,
 <column c_double_b, type double>,
 <column c_string_a, type string>,
 <column c_string_b, type string>,
 <column c_bool_a, type boolean>,
 <column c_bool_b, type boolean>,
 <column c_datetime_a, type datetime>,
 <column c_datetime_b, type datetime>]

DataFrame API

>>> from odps.df import DataFrame
>>> df = DataFrame(o.get_table('pyodps_iris'))
>>> df.dtypes
odps.Schema {
  sepallength           float64
  sepalwidth            float64
  petallength           float64
  petalwidth            float64
  name                  string
}
>>> df.head(5)
|==========================================|   1 /  1  (100.00%)         0s
   sepallength  sepalwidth  petallength  petalwidth         name
0          5.1         3.5          1.4         0.2  Iris-setosa
1          4.9         3.0          1.4         0.2  Iris-setosa
2          4.7         3.2          1.3         0.2  Iris-setosa
3          4.6         3.1          1.5         0.2  Iris-setosa
4          5.0         3.6          1.4         0.2  Iris-setosa
>>> df[df.sepalwidth > 3]['name', 'sepalwidth'].head(5)
|==========================================|   1 /  1  (100.00%)        12s
          name  sepalwidth
0  Iris-setosa         3.5
1  Iris-setosa         3.2
2  Iris-setosa         3.1
3  Iris-setosa         3.6
4  Iris-setosa         3.9

Command-line and IPython enhancement

In [1]: %load_ext odps

In [2]: %enter
Out[2]: <odps.inter.Room at 0x10fe0e450>

In [3]: %sql select * from pyodps_iris limit 5
|==========================================|   1 /  1  (100.00%)         2s
Out[3]:
   sepallength  sepalwidth  petallength  petalwidth         name
0          5.1         3.5          1.4         0.2  Iris-setosa
1          4.9         3.0          1.4         0.2  Iris-setosa
2          4.7         3.2          1.3         0.2  Iris-setosa
3          4.6         3.1          1.5         0.2  Iris-setosa
4          5.0         3.6          1.4         0.2  Iris-setosa

Python UDF Debugging Tool

#file: plus.py
from odps.udf import annotate

@annotate('bigint,bigint->bigint')
class Plus(object):
    def evaluate(self, a, b):
        return a + b
$ cat plus.input
1,1
3,2
$ pyou plus.Plus < plus.input
2
5

Contributing

For a development install, clone the repository and then install from source:

git clone https://github.com/aliyun/aliyun-odps-python-sdk
cd pyodps
pip install -r requirements.txt -e .

If you need to modify the frontend code, you need to install nodejs/npm. To build and install your frontend code, use

python setup.py build_js
python setup.py install_js

License

Licensed under the Apache License 2.0

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

pyodps-0.7.15.tar.gz (840.4 kB view details)

Uploaded Source

Built Distributions

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

pyodps-0.7.15-cp36-cp36m-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.6mWindows x86-64

pyodps-0.7.15-cp36-cp36m-win32.whl (1.3 MB view details)

Uploaded CPython 3.6mWindows x86

pyodps-0.7.15-cp36-cp36m-manylinux1_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.6m

pyodps-0.7.15-cp36-cp36m-manylinux1_i686.whl (2.1 MB view details)

Uploaded CPython 3.6m

pyodps-0.7.15-cp36-cp36m-macosx_10_12_x86_64.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.6mmacOS 10.10+ Intel (x86-64, i386)macOS 10.10+ x86-64macOS 10.12+ x86-64macOS 10.9+ Intel (x86-64, i386)macOS 10.9+ x86-64

pyodps-0.7.15-cp35-cp35m-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.5mWindows x86-64

pyodps-0.7.15-cp35-cp35m-win32.whl (1.3 MB view details)

Uploaded CPython 3.5mWindows x86

pyodps-0.7.15-cp35-cp35m-manylinux1_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.5m

pyodps-0.7.15-cp35-cp35m-manylinux1_i686.whl (2.1 MB view details)

Uploaded CPython 3.5m

pyodps-0.7.15-cp35-cp35m-macosx_10_12_x86_64.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.5mmacOS 10.10+ Intel (x86-64, i386)macOS 10.10+ x86-64macOS 10.12+ x86-64macOS 10.9+ Intel (x86-64, i386)macOS 10.9+ x86-64

pyodps-0.7.15-cp27-cp27mu-manylinux1_x86_64.whl (2.1 MB view details)

Uploaded CPython 2.7mu

pyodps-0.7.15-cp27-cp27mu-manylinux1_i686.whl (2.0 MB view details)

Uploaded CPython 2.7mu

pyodps-0.7.15-cp27-cp27m-win_amd64.whl (1.3 MB view details)

Uploaded CPython 2.7mWindows x86-64

pyodps-0.7.15-cp27-cp27m-win32.whl (1.3 MB view details)

Uploaded CPython 2.7mWindows x86

pyodps-0.7.15-cp27-cp27m-manylinux1_x86_64.whl (2.1 MB view details)

Uploaded CPython 2.7m

pyodps-0.7.15-cp27-cp27m-manylinux1_i686.whl (2.0 MB view details)

Uploaded CPython 2.7m

pyodps-0.7.15-cp27-cp27m-macosx_10_12_x86_64.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (1.3 MB view details)

Uploaded CPython 2.7mmacOS 10.10+ Intel (x86-64, i386)macOS 10.10+ x86-64macOS 10.12+ x86-64macOS 10.9+ Intel (x86-64, i386)macOS 10.9+ x86-64

File details

Details for the file pyodps-0.7.15.tar.gz.

File metadata

  • Download URL: pyodps-0.7.15.tar.gz
  • Upload date:
  • Size: 840.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pyodps-0.7.15.tar.gz
Algorithm Hash digest
SHA256 75531fc4d549b89ad25bbeb58cac5a25048c9bb33835e6761fc2413f397e42fe
MD5 6130458d088a867fa2af743431fdc7e7
BLAKE2b-256 91348fd6d1b8850e36ace8071a27a5fcd49908e7bef596101f4890e13fc0482c

See more details on using hashes here.

File details

Details for the file pyodps-0.7.15-cp36-cp36m-win_amd64.whl.

File metadata

File hashes

Hashes for pyodps-0.7.15-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 08b42b3f2c929482c04a04286b8693c846bd81e0e7c4d6ec9f1cfa9581cb8615
MD5 648f755516e972714734ba67d334ad5d
BLAKE2b-256 f1788f1ab8712c10b6aef7b7ee4a58ed6d8e9607131f3fd58a2618914be2a930

See more details on using hashes here.

File details

Details for the file pyodps-0.7.15-cp36-cp36m-win32.whl.

File metadata

File hashes

Hashes for pyodps-0.7.15-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 00365fdc858e34e2d7d604c9adcc25c92a408176faeee042b7c264e14252a874
MD5 615691894b97057038ff12dc0a604243
BLAKE2b-256 c9bc1a29bcbc45e88eb8a171bf5f63156642d2f4cdcd8f0f44e176c3a593b035

See more details on using hashes here.

File details

Details for the file pyodps-0.7.15-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for pyodps-0.7.15-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 78ea22f3e7783623bca0b1adb30d16c8f9502404ce3f27ad579077a9cc302cc8
MD5 2b81792fd4462dfd06c6400308f622f1
BLAKE2b-256 0829bbd9021a0eae27b91188ed18d20e5aa92cefdd5bcec74a3912bf917bf8b8

See more details on using hashes here.

File details

Details for the file pyodps-0.7.15-cp36-cp36m-manylinux1_i686.whl.

File metadata

File hashes

Hashes for pyodps-0.7.15-cp36-cp36m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 00963d38f58b29ecb00a34fbbfb3d609d1a448779b5a61bcba92e555eebac36a
MD5 4ba80c263000e9ab2c017765f2d882b5
BLAKE2b-256 7de8aae8f488df3ae764c69bcd303d4175b39dee7e50b9f0fc388469fd2a164c

See more details on using hashes here.

File details

Details for the file pyodps-0.7.15-cp36-cp36m-macosx_10_12_x86_64.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl.

File metadata

File hashes

Hashes for pyodps-0.7.15-cp36-cp36m-macosx_10_12_x86_64.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Algorithm Hash digest
SHA256 46159296debfc02f9f36030b16c62474e6f58b4c80eefbe3b3d4daf3071a2200
MD5 ff1500d88df1d2f63708065506064560
BLAKE2b-256 04ca1e44ca4dfa0a53d5f204cf2b3597d81522a293a99608958ed3464e8eea31

See more details on using hashes here.

File details

Details for the file pyodps-0.7.15-cp35-cp35m-win_amd64.whl.

File metadata

File hashes

Hashes for pyodps-0.7.15-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 bd8776bce628f3667916e5f768131acf1b620335cabe485e9dc8e7ef4838c434
MD5 3d1956c5d393e9309818d02712d496f1
BLAKE2b-256 714eeea64d832555de15848ac10886cb8e444e097e579a3b2ccb77238528907e

See more details on using hashes here.

File details

Details for the file pyodps-0.7.15-cp35-cp35m-win32.whl.

File metadata

File hashes

Hashes for pyodps-0.7.15-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 c302803639a29df7b8630a7b5776c92564a204354de929cd683c3a8516d70c1e
MD5 5c09f75248f79261d1a37e48d676a069
BLAKE2b-256 c6d8c63f7e8f6e476634c8b981eeaf1a92c7ccf7c8872ed52b2aa19a89f65674

See more details on using hashes here.

File details

Details for the file pyodps-0.7.15-cp35-cp35m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for pyodps-0.7.15-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 0414a35870620173eaba6c3c8c5f7e2473ad1751faa0a8dca054b23128b00e98
MD5 b1e0921c30c67c0778217631ca629ecd
BLAKE2b-256 a4b0a6959c50807cbf9e9f652fa6d528f843ab35f405635206d0677c92efe679

See more details on using hashes here.

File details

Details for the file pyodps-0.7.15-cp35-cp35m-manylinux1_i686.whl.

File metadata

File hashes

Hashes for pyodps-0.7.15-cp35-cp35m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 e1e0bf4f742e2b31265ca4e808e8bb1988e196e0a487e7b391cc4dfea29f5355
MD5 1f711ba267aa5ea6854cda7dac4fd05c
BLAKE2b-256 b191917df8a57e08e9e971514df2aeb31e442e5fa13601be3759018c7fcc2813

See more details on using hashes here.

File details

Details for the file pyodps-0.7.15-cp35-cp35m-macosx_10_12_x86_64.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl.

File metadata

File hashes

Hashes for pyodps-0.7.15-cp35-cp35m-macosx_10_12_x86_64.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Algorithm Hash digest
SHA256 c9ae99a65937afddfcbd918d67eb8d0da143cf4084be47703a278f01ec1969f0
MD5 6019e282395ff81230cffee9173054b1
BLAKE2b-256 d2bea14d4c175f969c84c7a235c954ef9e2642ce628e3f5f9affbe076caa1843

See more details on using hashes here.

File details

Details for the file pyodps-0.7.15-cp27-cp27mu-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for pyodps-0.7.15-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 636c3ae2daba35b83d8aa4a04b6618a47726edddb2d69460feca8a7776c55839
MD5 a6f70c46fa1ecdca2c816ed89b29adb9
BLAKE2b-256 bc4018a86facdf8aed34822871db950b94679d1bdf7605f2cd4730f2dd7b1fe7

See more details on using hashes here.

File details

Details for the file pyodps-0.7.15-cp27-cp27mu-manylinux1_i686.whl.

File metadata

File hashes

Hashes for pyodps-0.7.15-cp27-cp27mu-manylinux1_i686.whl
Algorithm Hash digest
SHA256 e4b92a3e8a0f1b305c55ea311eab15931c11b254fa21d904dc1514aba937de47
MD5 8ec76ae4fc1b158a091d048032fe85e2
BLAKE2b-256 dbe4004efa9a86e0c068de201276939d6d39585d76672a2628aa41beca7ebbfd

See more details on using hashes here.

File details

Details for the file pyodps-0.7.15-cp27-cp27m-win_amd64.whl.

File metadata

File hashes

Hashes for pyodps-0.7.15-cp27-cp27m-win_amd64.whl
Algorithm Hash digest
SHA256 f3abf1ddf3cfc5b23aacc003765f344c1b43250dd33e2cbc4bebdd334ee3fce3
MD5 baab1e6fde6a274ee4bdaaa8fb060e42
BLAKE2b-256 dc759d7d7e7a87d82e1c5e27507aa036fbc16db4672dd0a8dd35d140ec507f4c

See more details on using hashes here.

File details

Details for the file pyodps-0.7.15-cp27-cp27m-win32.whl.

File metadata

File hashes

Hashes for pyodps-0.7.15-cp27-cp27m-win32.whl
Algorithm Hash digest
SHA256 7e13f6db91a77bbaaffccf9c99e81d5fd7d7b17a1d67a3439a82ee1e63184ca7
MD5 f96f36c8dc0907b9ad25baf6adbd6a84
BLAKE2b-256 10c46dc76dd48644e245a0313a4052ecbe143fee97fe238e5f4bb6efd2f3aab8

See more details on using hashes here.

File details

Details for the file pyodps-0.7.15-cp27-cp27m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for pyodps-0.7.15-cp27-cp27m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 8e6bd2ac764d3840892d89bdfc1262333c168ccb1f8efb557534437dd9d8a10c
MD5 db0461356bc163f6b7d86c4ad7cbb36b
BLAKE2b-256 b1712cb24460cd80a84b87e7b6c24f21d9a489189d66a7e9d76fa9a66bc35b40

See more details on using hashes here.

File details

Details for the file pyodps-0.7.15-cp27-cp27m-manylinux1_i686.whl.

File metadata

File hashes

Hashes for pyodps-0.7.15-cp27-cp27m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 9fa93c1c9aebcd012c9f2964e5a9c97600d376f814ce94e63260cd0ad0de1e2b
MD5 839f267512916262fe02e4cdebe479c9
BLAKE2b-256 c4b18ade4e4df131716b27dceb86bbf46b997893bcb999e53a01aa5961aa15fd

See more details on using hashes here.

File details

Details for the file pyodps-0.7.15-cp27-cp27m-macosx_10_12_x86_64.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl.

File metadata

File hashes

Hashes for pyodps-0.7.15-cp27-cp27m-macosx_10_12_x86_64.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Algorithm Hash digest
SHA256 618c7688b9fef1bd923cf77191ef1bee885c6f12501946d48574b9b6ef380472
MD5 791e2f5015026615631c6074af8c9957
BLAKE2b-256 b96614434da9d028b2ab5ddf9254ad24449a580929fa33b086d76bcdb508a9ec

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