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.16-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7325bf1ae0dc3cf950ae56cf518a18ebc001efc129f9eb9943c5ceac4c057039 |
|
MD5 | 5ffb2b9872e90f6ba40acd4c0ea2ef47 |
|
BLAKE2b-256 | 2f79597c027f92709a181a8eb3eb903ac8f89e9be5dd26c2eebf7e4a12671815 |
Hashes for pyodps-0.7.16-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 54a6c3810a4ce318d589aef32a072c246539b8db47e32719fe07302c44eece88 |
|
MD5 | 0719f99e828fb0b1c403cfedd80be0a5 |
|
BLAKE2b-256 | 4c3260efd11b952b52374b697aec3c8895e5b3991fc4f03ed86946cacd3d372f |
Hashes for pyodps-0.7.16-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 78a72372180208132f22c5caec7a0ad5745f46e95baba5f30d9e387b27b5a4b7 |
|
MD5 | db3ca7a3f91cb7ef8d49988f024283d0 |
|
BLAKE2b-256 | 30e19c3b67421025ad71e088d6f27473095d60916544c984004297f9b3c5dfc0 |
Hashes for pyodps-0.7.16-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1e1b90c09774654b9e70d11e6f2f9aff35afc6e3140b576b5b67055b8c11789 |
|
MD5 | fcae4fec3ca3b3965e11e4ba5b8b3c77 |
|
BLAKE2b-256 | 114da6c1690298a18b12de7724a5a5d61ebd2392436a0cff405ce5a505d053b7 |
Hashes for pyodps-0.7.16-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 | 2a02c86bb2e79478db991e9c9980cd77490b239d1e7e8834470c89530f013509 |
|
MD5 | 1e7d415316a3d3371fca3d2ca3e581e8 |
|
BLAKE2b-256 | ed1721d54e6e947133c4fe1b802d653d839ec2cb71a6ef33a525979f9d2ea126 |
Hashes for pyodps-0.7.16-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ddfe051a4bcf660171e8b1691ee9bb858912fef2395fae6bf3180e61764df5ac |
|
MD5 | 5438dfe1ab6c7e116cefa1a7a979c76a |
|
BLAKE2b-256 | 2f2947e702e6f6e6e3acd6dcbc11ec7c8a655d7dd74bfbdb20a470ad8d023f04 |
Hashes for pyodps-0.7.16-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 06d6403cffa5d7dbefb68f9a81a1263d69e4090037a7d49ac9863a6ace5731f1 |
|
MD5 | cce808d75875c6ed8c8e4e895b8b10cc |
|
BLAKE2b-256 | f5d6fa19062dd8ed8618116dbf86ba527c7f47d605b01ce368c54550a017696b |
Hashes for pyodps-0.7.16-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f01d5edb5ad29ee3fb27cfa9f9a48f3f74fe5a705494d9b7b5669756decd3410 |
|
MD5 | cd2b149f280447cb1c3da425f610bb29 |
|
BLAKE2b-256 | 54d70770a0e4689f32a15080040d14e3b591997b0377dd750f4ee8aab10860d4 |
Hashes for pyodps-0.7.16-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 37d2fb2cdbd2f4b06da237590487749cd3b261276a8a6f61f5428d925239a8b9 |
|
MD5 | c863c47822c95e870581fb4b0c3b0e38 |
|
BLAKE2b-256 | e271cac3b1c0657c004fb43ad362f6290476fa131f046737f53f0e6646fc1822 |
Hashes for pyodps-0.7.16-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 | 531113dbb11897edf09934a99c42a2d6d21c2b518eeba9a9f07b523e4fe59f38 |
|
MD5 | e4b19a465444969aa2d94a4d2b329837 |
|
BLAKE2b-256 | 3db6d46a733669ac75880d406957e5dce1983acdfa73148edc58bf8b14f26deb |
Hashes for pyodps-0.7.16-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2480f39059ca616605733c41e35fc8a5cb9e25366dc1d1470a052a8c288f4d56 |
|
MD5 | 5646bfba9ce18f9141c244524e8dbf9d |
|
BLAKE2b-256 | a98b988046db27c6c3923a5258b9eea74f492a283eeae7ba027bbf80e4931070 |
Hashes for pyodps-0.7.16-cp27-cp27mu-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 587baf0de3246f832db2da111d537f5ce7078a35ee151ac3890b655e4941f40a |
|
MD5 | eb7529f7a06d5a7a3f333b33fae7a6f0 |
|
BLAKE2b-256 | 3267fbb1ef5e72e3cd172c408434d5cc234096edebc7ec398585df20fc723045 |
Hashes for pyodps-0.7.16-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ed203971f4a89c4b086e3b0f3480bb8229bee4c1663542d18aa802cdde5c658 |
|
MD5 | 5cdd5380528a224829784dfbd04b787c |
|
BLAKE2b-256 | 3beb76313c4555e7694ce6b21a2bbe29571dcfcacba1d66a7915b16e7e24bd58 |
Hashes for pyodps-0.7.16-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 52ed1bea6f1f5f15804386837f046af1b083064e1886555bc2bf8bbff0ee4834 |
|
MD5 | f654188561a40f46765dc27be5e785cb |
|
BLAKE2b-256 | a512e38329ebe11d99dcf6eaef0a2381710470ce3e9fa1e1f1f10dfb143d32f8 |
Hashes for pyodps-0.7.16-cp27-cp27m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 30cdef3be0d6c6d303503d57b412e0816277da3debd92e7198619327c6053b6a |
|
MD5 | 45925a92f2375d165d345343c335e6bf |
|
BLAKE2b-256 | 1faa97ca0b5c28fa385b030b3d1e6f6cf6a48360ee70a0c76276b5c515a980b3 |
Hashes for pyodps-0.7.16-cp27-cp27m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 16bc0308cacf8c64d778b915326f5e1028e3b262a83a52ab1cac3aff11b93767 |
|
MD5 | 4dec41402e473ef2f3bc68d8cfc11dac |
|
BLAKE2b-256 | 273a219b74eb1239bcf8483417bbdfd092711a278510742c407f1ee3aa48712a |
Hashes for pyodps-0.7.16-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 | 637055591287b6c574c263de7ef0e50f049c87aabc81bbea361be80a6272289e |
|
MD5 | 6d44ee756ba9568bad7b35d19a6f63b1 |
|
BLAKE2b-256 | f32c5f046354eb843b6aef904f619ab8fe3dec0e785a0834036070f705fa1fb1 |