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.7.2-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 68fc7ad4ed1b4f332fbd8ea341fdd6fe7ba2d5e3194c5d9787fc17b7fe57b80c |
|
MD5 | de9b7f9acd6142ec2d734bf5610698f0 |
|
BLAKE2b-256 | 4b9c41c53cdaa529f05c1b08131b48f2a3d1d2fa984a5b4cc5d133cc60b644e7 |
Hashes for pyodps-0.7.7.2-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b52fa888c815783ba6084de72e2be10674ba08e8ee0ad1c3dd0223c68c84258 |
|
MD5 | 6255c636ec3d2b92f03d9f3434275518 |
|
BLAKE2b-256 | 8a9a746a0d11ec247df823f515b2579c293a131a4848314637819a15655127cd |
Hashes for pyodps-0.7.7.2-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 553cefc1d8f3e5f8598724c1705edc99dbbda009300d9dc5fb4998e6e7a07fde |
|
MD5 | 50bc18d13ce60c59b6f4a9c2a55e21c3 |
|
BLAKE2b-256 | cc576907d735c6c98ef5d16f62688348a69172e46e3788375feb4f65578e6806 |
Hashes for pyodps-0.7.7.2-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 379280b46e0d7e798a13c38805e72fde10dfc24fd533ee67e882055234760356 |
|
MD5 | 527db0961d29b8dcb79c7a14407dd2ab |
|
BLAKE2b-256 | 3a01eeb58bff1eca3c5f4bd1f974b7443c8b0b1e370efa8acdfeba6229643910 |
Hashes for pyodps-0.7.7.2-cp36-cp36m-macosx_10_11_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 | 2fdd79ba8d54890f5ce9e65f663ba63fb9bde49f6a2799cbe968cdec63841dcd |
|
MD5 | 09a2d8752f68cda2c9d827712b67016c |
|
BLAKE2b-256 | 3b78841b72b26f61a330192fd66cd66d61421543722a2a6aa995f18d6ae774bd |
Hashes for pyodps-0.7.7.2-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 351e9680b29459d3d18190ea27b56a2d9076bbaacafd8678a9c195d6f9c5ac87 |
|
MD5 | 750746231ab05c1cc89fb9ec7e47e9f7 |
|
BLAKE2b-256 | f79cf674344d3cf0225edd5d60bc2c5945f95e26fbad511e3cfe9362ae9b91ff |
Hashes for pyodps-0.7.7.2-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f13eb895fec6f3ca0455bf9334c970910fa07b4394e9297a1b9987a3ba3657e |
|
MD5 | 4311c3fe7f3bfccea336e9f6ff6a3ed2 |
|
BLAKE2b-256 | 6dce8cedbf51785d424c9018233e7cece5839edf90a33054efd2ae59bc5605c0 |
Hashes for pyodps-0.7.7.2-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 955be8acc98c8dbdc9702a987f11681393e014c857197970d7a1a8268a69fb3b |
|
MD5 | 01cdad42b2d688349685c583020bbf76 |
|
BLAKE2b-256 | e4d4af6a3a4dcdc0974ddc4acdaa1d9d104b1888abc69aa08c92ccfc9ccba095 |
Hashes for pyodps-0.7.7.2-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 37b7fa2ba8b76d0bc5cbc715ef20bdb76b1b2f1fd56de0543281ccd85311a183 |
|
MD5 | 8ba8a7e8aaa63abf991c2d3edac31cef |
|
BLAKE2b-256 | 598315146e68f275ab218e994e2eebd22c4f74224aa138f40b2b148cb834a41a |
Hashes for pyodps-0.7.7.2-cp35-cp35m-macosx_10_11_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 | 9286420b4a67a71bec1c7692e73df7ce1ca6b02aaa219cbca6241dbbf3ecc306 |
|
MD5 | 5bb210e4186fa3dff23d99b29c6b2a13 |
|
BLAKE2b-256 | eebe346433f784cbb10e02526ce80d70f3a177f414846a68f2ece5eaf264d75a |
Hashes for pyodps-0.7.7.2-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95b0b32d851932285c67e6968a1d9b809c10d4401af0c091384051afda21e838 |
|
MD5 | 7b9d906e6dac76a926b9c4e0d7574360 |
|
BLAKE2b-256 | 3374676df12c5506ed8a7ff4a2399a99a26a0a5cb8437cf43d9dbfd1db4bfbb1 |
Hashes for pyodps-0.7.7.2-cp27-cp27mu-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d28387ddf295116601a9d007c78ac61daa4605df6d212086f7fdb5dcdb9bf7c |
|
MD5 | 64f770fff7099395cbdeeb07805a1eef |
|
BLAKE2b-256 | ac91a6c3451564f31f76679c92b30e54debe3523d5e0cef7a674c3dde744b102 |
Hashes for pyodps-0.7.7.2-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca52f004d16d46266fd86386078c956128478913e569daee0cf285c9dfcd2bd0 |
|
MD5 | 8ff3c9b752310e37fdcd0a919065fa63 |
|
BLAKE2b-256 | 27218cd0d43e55bf7896e9c853ac0572a103aac525c35cf18765aca29a28b80c |
Hashes for pyodps-0.7.7.2-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | af3df1f64899fe8d2d4eb3823e719ec46a897b7588626ecf2e9ce1456a943616 |
|
MD5 | 238e58a0bd2935cee94df3cb1b26699a |
|
BLAKE2b-256 | ff608e76261634812058e02681b3b79d05d5760e9e5da0bc4eb2c1af584d766b |
Hashes for pyodps-0.7.7.2-cp27-cp27m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 18acbe48c20c386d076f9f813a9d2a0d209608ae183ec236ef1522baed5d66b4 |
|
MD5 | 5a2e184fbc4c928e382f776e713a0409 |
|
BLAKE2b-256 | c92b8c8520d2506071a1801a1aca46571103a7ff8f0d07f7fe194a48a1c6dfc8 |
Hashes for pyodps-0.7.7.2-cp27-cp27m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ef57382f5b0689295030ec251393898b56bb0d6f703e7890f619dce5a6dfc52 |
|
MD5 | b2ba9ba8be84816ea76318602c5e6ec1 |
|
BLAKE2b-256 | 7b82aa60eb585b1916ce7cea70079afb35e2fbdc8c5e884d23127b3aa2dc3f89 |
Hashes for pyodps-0.7.7.2-cp27-cp27m-macosx_10_11_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 | 4a28fdcb47a24c3cbb7065f8cd74e63cb9ae019f1d261bb154a2742e49808bd6 |
|
MD5 | 375e400798f552b4d804e8d356fe8955 |
|
BLAKE2b-256 | c40673e95f45eece319b9b0a690e96542178447b90392b58bd4f2a15393570f0 |