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.17-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5af550a3e22b198c9c2b1587ef65d05465fe1a94899509348f80d9600e731dc9 |
|
MD5 | e89191bf5a0ab72ddb697da4228051ac |
|
BLAKE2b-256 | d4c7981dbb9c76d296cc14d3e6aa651d27bd83a3af8c063c3dd0f4d07d728182 |
Hashes for pyodps-0.7.17-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d9f403fce97051c6093ca6055dccb6fe1fa405a6829e104b12e9a4f40fde6f2 |
|
MD5 | aa2ce698194ae53c8271d7b40a0e9e5b |
|
BLAKE2b-256 | f04c0f6197b5615e0470679c84da255f623f22f9d856d82609b62679d3e0795b |
Hashes for pyodps-0.7.17-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea9999ba56c63cac1ed577cbddf68c5dc321dcb07bfd014f11605f1ac9502b9e |
|
MD5 | bb0dea79f8f6ca3a776f817d6f849e4d |
|
BLAKE2b-256 | e2c7757489cb464e9e99b57af80e1314465f03358e425ddffc8961ce55683ebe |
Hashes for pyodps-0.7.17-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 22572971ac89a6d43de4577c4423c3efa23a6a30a6b5d8ff568a8fb8b6a69312 |
|
MD5 | 6dc54a06f7fac805342320529eaf8159 |
|
BLAKE2b-256 | e56fd65baf317bf7bde3046ea379f72b77ec57897ddb5f8de1a9c38aa60b184e |
Hashes for pyodps-0.7.17-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 | 4198fa9cc571578dd37a8911ce8b372c65ef5c62e56df1b418ee08ab5f4e4ab6 |
|
MD5 | ede0fd99cc47aac5dbcb51eede207708 |
|
BLAKE2b-256 | 50ff2c2fbe56f32e1874eb36bedd49172a3a9dd1d8a90f6f48912973f7b2bc98 |
Hashes for pyodps-0.7.17-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a02a07dad35adc6b40a221423279e5b7fe7d3224401b5ea321426d2a55482ca3 |
|
MD5 | 79bd42033e85a3313d8ca16062ff4f6a |
|
BLAKE2b-256 | da0ba9fbabb1b225a8511eef937d25ddbf9870cba815aa7223fc5b500d1a0dc8 |
Hashes for pyodps-0.7.17-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 58242a875cac18fc5f2e3b51a31973991730f3576c8f30c15b09c581f8853d70 |
|
MD5 | 525638f1cc3c5895f374d8919edf0e4f |
|
BLAKE2b-256 | f7bc8d4ff073bada5cc9a270e6f05bf9f75f56728b0e903745894ad0053740b3 |
Hashes for pyodps-0.7.17-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 542af2ad4d9f16a27b1af45c04a0483ba2161478f34938a2666aaaa375a5ed35 |
|
MD5 | a9caae5c5b4425a269f060191f7f9c05 |
|
BLAKE2b-256 | b1b114dd9f7b7a872b42a33d5fc6a4de39431a6e0ab495cfc5e336aedd86e2c2 |
Hashes for pyodps-0.7.17-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a825d246b86a14fc0e8467cb09e6c59a0004b92c038e11a6c187b70aaf0fd5af |
|
MD5 | 9626126d5c5078691509eb803f9719b4 |
|
BLAKE2b-256 | e18d45acce2d02cc7cdfdd21b647503beb6da77e84fec6a745261ea1c2659c87 |
Hashes for pyodps-0.7.17-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 | 3193e1cb1f2731e21279fa323d0e803d55c42fdaf36cfe9b4bbcfc115954559a |
|
MD5 | 2148c44767ab88c623f5209ce5c3d92f |
|
BLAKE2b-256 | 6ca49ca02aade5c70a8c9c1688a28f5c1076d5910422730c0ba7a344e0272737 |
Hashes for pyodps-0.7.17-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8c16d5d79d69755d5e07d539124eb9c205b22bf56e1dd61359d1e47010ad863e |
|
MD5 | 10050d8d84902ee3154bc64e41ff6c87 |
|
BLAKE2b-256 | 2fa49ba67513a7485d1118bbf0dd425e650edaccde2dc05684f0e170807c051c |
Hashes for pyodps-0.7.17-cp27-cp27mu-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 49a615038f592a8860219709d24dcc42297a8ed9ecec753a18026dec9699e792 |
|
MD5 | ffc3498d958d05c20466b178ba012358 |
|
BLAKE2b-256 | c1c9faaf3a6110772d76b0dd7f3be72ae162479725f4284921b994ef4a3b98a1 |
Hashes for pyodps-0.7.17-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f3f0e7e7d60766796535ebffb033d1f94ee6b944903a4189799d13e4fbc67e5e |
|
MD5 | 4d4209b919cbcbfbbfaacec61771a22d |
|
BLAKE2b-256 | 59da2c75deae786f0dc8520a4ab016748d8250db162c525a7656d280ad75ef5c |
Hashes for pyodps-0.7.17-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d9c1373096b43d7ea21d7264071f452f668dc7350301972cf1805950150f3bf |
|
MD5 | c5cadd3a2e188edd0783b18b003803a3 |
|
BLAKE2b-256 | 0d8b6784440c0921e455bfbcc498678053fc78356aace55b9fd009536dd52f4d |
Hashes for pyodps-0.7.17-cp27-cp27m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ebd527754562d81ac61ed8180cdbc1139d1c888ad712079f2f9f350a9e34688c |
|
MD5 | d6695c2409336821ec1bae8e20e52d72 |
|
BLAKE2b-256 | a9d828ce470822a736430cb5c396c0ea9676d99c6e00ccdcd32110b958c3e6cc |
Hashes for pyodps-0.7.17-cp27-cp27m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f4a7ac4bf94e7f8a591c49000578f0a0bc951baf7cd15bf9ec5ad5b29e9dc53 |
|
MD5 | c521859e186ab88b7fdca06d5a2489c4 |
|
BLAKE2b-256 | d63a797b8a5c379753ed4d0f0d1cd46dbbfb741038fed7e540957aa9024a00e5 |
Hashes for pyodps-0.7.17-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 | a01d49686d6f9a1e204f37505f18d33d68f80c54c6ef7a8b55cb18a7ce246ee2 |
|
MD5 | b085f2ca3e04b8516fa3b06faf6bd717 |
|
BLAKE2b-256 | fcec70cfcd53b2252232eeeae1cc2ae19468a61919b006cca5dc8c16e8ab3390 |