ODPS Python SDK and data analysis framework
Project description
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
Built Distributions
Hashes for pyodps-0.7.19-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1cc621bbe7bc26d0f1d508794ec4500dc6f8b4d5b328638ac4f2538724971429 |
|
MD5 | 5c72624def5f35be053ca1244903f59a |
|
BLAKE2b-256 | d73b8edb724087554940b87434303d7ffa3b1685f2f25730ebbc4331d7a8444a |
Hashes for pyodps-0.7.19-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b51cb1d9deab568fb3d98dfafdf1c1bc019ab2fbf7aa3ff62fb479b8f4a81bd7 |
|
MD5 | f2e0f89c97601c4a5e2d6ae4708c6585 |
|
BLAKE2b-256 | 42722879cb3feae2e9beaa6a7262e5596629f881dafebe7d927bf690860aeef4 |
Hashes for pyodps-0.7.19-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 485905a8ae3f2576c98a3a8cd0dfc03b2e8aac44ca61d635fb4531ccef68d1fd |
|
MD5 | 47281a936ec183ec372db6b1357ee108 |
|
BLAKE2b-256 | 574befa8d45845b05ab9e4556baa23927d0cd1605c7f0f89bf50d131d9d5da0b |
Hashes for pyodps-0.7.19-cp37-cp37m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 382e3fe56312a138309552aa70a8673d8e6a31557b08f1e9f091938491bd6f55 |
|
MD5 | 9db4738d3b8a4cfe669f126596bf802a |
|
BLAKE2b-256 | d2450974bb998f4f87d2209ba92f35320aab2e53c88dd316412f9fdc074ab167 |
Hashes for pyodps-0.7.19-cp37-cp37m-macosx_10_13_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 | c6085861a862822878f7c6b306edbe680d1a43899b1172de23b54cdadf6b3fbf |
|
MD5 | a239c6526e6465913869ee9e7a51a24c |
|
BLAKE2b-256 | 87116d745abdc45b0cf16a49394d253bf467471f72ab1a8228f66c69e57ccffa |
Hashes for pyodps-0.7.19-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0000a8f99f6ca000b4d2f09ba360c760b5ac7d11ed31269aca490db0a14ef4cf |
|
MD5 | b1a5624bd9256c8a66227deb7cc2aa9f |
|
BLAKE2b-256 | 5e41bc7b6c7f702b17399d91802ee8e03c8a264bc3201c8391de2c2b3876f967 |
Hashes for pyodps-0.7.19-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6733c2988872cf578d493d78996395990f24d36bc918326753e80e808a384dad |
|
MD5 | 74fa2586a3fc4b54018b27c903c918d6 |
|
BLAKE2b-256 | 7c8a5a399cf8a773e3d1141f14a9d0977869d0080fa5c5692ec870037134727f |
Hashes for pyodps-0.7.19-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9ef775fc763ec1f2326da5a9b86b93fc6aba931023835f2a6069029ce13c5f4 |
|
MD5 | 307ef94025281833df75fe1961297d23 |
|
BLAKE2b-256 | d51d24a8fcbe82f90963b4c201a64629b553fe19ab0a5f8bf4942dbe5d0a16b5 |
Hashes for pyodps-0.7.19-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b01d704ba28c941a8c53c95e9feac24cc02bba2e74cd3472d89d9c0b2dfe224 |
|
MD5 | 82af9645ee384cf84eceae2af8544e61 |
|
BLAKE2b-256 | 63bc742a9e664ccdf89faa342a41189693f3b9302b8715321ae5aa87ab4eb843 |
Hashes for pyodps-0.7.19-cp36-cp36m-macosx_10_13_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 | 390c43627bf33a8cd0d2ff705f53d83d4a9fb953d7f94019b9f0fab163725b38 |
|
MD5 | 19a9d9943c73ac3424dcfb5ee8179503 |
|
BLAKE2b-256 | 1e533396447db023c14cd88fe5e3a98d53ad6efdfd7cee42432427b561768f7d |
Hashes for pyodps-0.7.19-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 34fd726a96f732ea0d09c4ce6d0a3675306ef48a68192f1b34633609ecb2c4f5 |
|
MD5 | c404aa67ead4dbbab052563251eb69e2 |
|
BLAKE2b-256 | eb386080fd062349d3054560153a6c84fe10e6bb7469a0e80aa6b5aa68a8609e |
Hashes for pyodps-0.7.19-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 596d04a9c13e2f3fcd3d2377140d740b8fb6917dab2b2c039801f4ca03876386 |
|
MD5 | 089c2fe001d063e813dddf50b27ae0eb |
|
BLAKE2b-256 | e3e02ee79787eac799b065a1fdc3cd0ebac150494e681c9fbeb14077e145ced1 |
Hashes for pyodps-0.7.19-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9fcd44ed104cff3ed3e9115c0cfd20ea891b0d541b96db3941f43861170158ee |
|
MD5 | fb8d9e03b169854130ee22906bf9b09b |
|
BLAKE2b-256 | e5eeec759bfee1520ff892e553a9ac12c070876daae49e333048b10ec23d529e |
Hashes for pyodps-0.7.19-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 00f42e675768e7076cda50d3a6bfd794e198dafc86637c391191aafefefde97f |
|
MD5 | d29688db821d7da3bf27d98d160a38c1 |
|
BLAKE2b-256 | 94ef594c2a5079390e2d20d7f8064ee1a4ea23c9660f1f69c0e85dca582fd255 |
Hashes for pyodps-0.7.19-cp35-cp35m-macosx_10_13_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 | ef3fa81542ac56b68da9c135fc11d321ec7c3398dd408b3f0d6d1ac8ef74f46c |
|
MD5 | 2844130be2cf1fb9cf236b66f9abbef7 |
|
BLAKE2b-256 | ef3cad4d3d44b22bbee375eea0814891a8efc4a27f4a2d69dc3d6e4c400983fd |
Hashes for pyodps-0.7.19-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4c32566c27c8f6b6a8f25d68d30561c79308af063c92f2cfa812e0535de73aa |
|
MD5 | 8b14f6a9d2ab07ba9ca19fa223bc1d85 |
|
BLAKE2b-256 | af71a6b16411581baace42ca8ea51a708325703e932e1cbc05cbb67895ef5127 |
Hashes for pyodps-0.7.19-cp27-cp27mu-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a714435ba63422ed3f97977b0dd661af795478e8d6e1de648c80e9d18b5bd0ca |
|
MD5 | 177230b3e41ecc537f532d54e18cddca |
|
BLAKE2b-256 | a11de517e9fc6fdcb3a97d8a08017e4f0c0786d317ed64f46dd630e7b06dcb8d |
Hashes for pyodps-0.7.19-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1cfdcb415a1c6f353d551306c3b2a7cf9889a78df292b9ecb854bb678ad7f880 |
|
MD5 | 4f83d428b96186c78e58d154efc1e1f0 |
|
BLAKE2b-256 | 8001379f9ee7a850e1b97611efc1de8623a8c83144e2c75dab9c82b36c0f7760 |
Hashes for pyodps-0.7.19-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a764330337dcb2f701b7a8712ef5128c464449997f58edf0f4f8852e6187f76 |
|
MD5 | 0368bb03003148b95b896b739e65c340 |
|
BLAKE2b-256 | 7d98f5c094750808dfa050f3a77b368c9f539f0e5f4e55ab85c68343bb397a0a |
Hashes for pyodps-0.7.19-cp27-cp27m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 76d4a836652c0fd710a2d60c8880ca88b997d4102eeda9545f81b5a503e2d7cf |
|
MD5 | 9fecd96f0e2881f351b7a578923b12f5 |
|
BLAKE2b-256 | fbd27c4eb9d3a16f49be7804f4e2f4f8f6d4b8ebd5cb44cd8b18a47cfb2ce009 |
Hashes for pyodps-0.7.19-cp27-cp27m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1e5aa64030f46e8b5b6fd051519bc823bb60046d42b3bc4c39d70732a2fb558 |
|
MD5 | 5d94b13949624eabba56846c1c3ed3e0 |
|
BLAKE2b-256 | b530e2516f7ecf66f2e82f30e0924e4e7d32fc7a608f561e209ec66398c86311 |
Hashes for pyodps-0.7.19-cp27-cp27m-macosx_10_13_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 | 3f6645efba4841dc7b6028a2417848c50db6f961a71b9c937b3867f8e24f21d8 |
|
MD5 | afeac121429caa9e86a7f6641c16a811 |
|
BLAKE2b-256 | de70d733999649a6c6277dd35730e70eee5d3de76adc998be0f6ff2cdea78a73 |