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.8.0-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd908f00d491453a78778932231590334b710beaa44c957ae47ac624d2d82bf9 |
|
MD5 | 063ccda723dd2e29c74a1d963e327ffe |
|
BLAKE2b-256 | 9080f61402d580d82803dec45f539d3d61721aab8e5303170ab2c6c1aeea83a9 |
Hashes for pyodps-0.8.0-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2584a69bb64d80e21b391974bca73f1368783f6fea001d37a9df2e444faf8035 |
|
MD5 | 1ab4481898996f7801ba9886e706bf31 |
|
BLAKE2b-256 | 6c64a52a2ff8b1febc468a4961af32e976290e25a6203dfe9e87b4b26c0ae04e |
Hashes for pyodps-0.8.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8234c90501e3d3e8a1f5b958ce9c06851a9541617cb6e9e0c84a7e9070faa6e4 |
|
MD5 | 63fe932a3f6703db493d827542123042 |
|
BLAKE2b-256 | 8721f3cf5851efcfe2fe9d089d1b961878624b1ed5b003bf597f52a8df319667 |
Hashes for pyodps-0.8.0-cp37-cp37m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2db267ee697b023a483f53b17744fefb576a56e32896e9c319a3d68e0f2e2b25 |
|
MD5 | 7c8f55d29d038b2978893df683dfe8d9 |
|
BLAKE2b-256 | c1637c6fcd862133c02f09253081fd77eab021a2b296d945772a86f0bf5bf2e8 |
Hashes for pyodps-0.8.0-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 | 637b0a6097939cc730e1db1977a1dac3688700e81ff9a72df988f3e9f114579a |
|
MD5 | 585087538e18457e3f072292662a6daf |
|
BLAKE2b-256 | 9e5f33d2529b7e4443077609be1382e813123b9d870e73fd7595aa54fc4901de |
Hashes for pyodps-0.8.0-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 24716a653e5587976f266c97131d2578b3fc1be938b970275715f4622ac04d33 |
|
MD5 | 1cfb9bd7d5346a60f0dc213d5dc7ca34 |
|
BLAKE2b-256 | 964c97a571fdb2b7dd29392e17687d024f278841b9d6bd380c2dcba33ae52764 |
Hashes for pyodps-0.8.0-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e345aaa8e3f2214203016541a86d2ebd1d59a1a9e52a881230acaef3500447b |
|
MD5 | 2c1a9c936ac3b32d0db295b1777dd4e6 |
|
BLAKE2b-256 | 0ed84b7326cd97b7e2375b95c0c432bc8a4bb3b4d636dbb1394863eee1fcf7b8 |
Hashes for pyodps-0.8.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7dd46970e576f1524756e186a6d307ca10f869adde9a31c3886539c2de3df91 |
|
MD5 | c94fb2c8dd47fbb3b9ab12567b9036ed |
|
BLAKE2b-256 | aec52aff694c8297bd158fd70d991af22e1ce4bb01ed2847abd17dff226a720d |
Hashes for pyodps-0.8.0-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6473acca7b937755151feec91dd449581e0d2a20f53675fa5a0e0d8afedbdd12 |
|
MD5 | 8cd34d77f362fdd0868efa64fd868b2d |
|
BLAKE2b-256 | 6fa7e007afd73beb6a915c9e83755ef957f802eb6970c4f0cb4ab2bdd038364a |
Hashes for pyodps-0.8.0-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 | de487d04eec914f0f83b9a8959768b0be3a2ca92d163ad3ad69b9097f45a0da2 |
|
MD5 | 52b193cc64b8a7c4305a22875e94f366 |
|
BLAKE2b-256 | 514af5be69ae355459ca156d69d453b693bd04d61b3225f0867eacda5d5a13d3 |
Hashes for pyodps-0.8.0-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 40593b764778e1fb7b7d3d15beae4098b723e6b8585057f3443895b1dbc68722 |
|
MD5 | b421af8ad549cd08220f76332a07ab30 |
|
BLAKE2b-256 | 021b5fffcedea402b9b4ebab20159e51433d8a95ec3b888c86c31d37f385ee07 |
Hashes for pyodps-0.8.0-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6eb02c52dd442155f7c678e0b6d93feb71ba1f2f21c0b18d31fbc47a76ad786d |
|
MD5 | 6b6431018157a164dad3637eac6d0de1 |
|
BLAKE2b-256 | 84c3ce9ff2354cf843cb42a5b2aaf6894129027a0974381a854c265feb0cb829 |
Hashes for pyodps-0.8.0-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b2bec9c4a1f69852b9adea9e1b70e22a1f7cf68f66bdd4ce00ca109cbc085e0f |
|
MD5 | 49d789cb393a7b74f5ab6161804e36c9 |
|
BLAKE2b-256 | 87d474efd0aaf36088cada71e4a41913d146247420f87ee0b69336ccbaad8c90 |
Hashes for pyodps-0.8.0-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cffac4731fb02de0edd5416feb8e8998a7086e093a9e29d5a5f57941a43706ef |
|
MD5 | 0be6fa6921b617c143f0e08d2297c416 |
|
BLAKE2b-256 | ed59390019c8ddba56b98e0ea5f43e9f39aac36026addbb1d3ab2ed729573e16 |
Hashes for pyodps-0.8.0-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 | 0a390d2f97c9e17a526675af69c279a406922ed165198150b538087ac0dc2d10 |
|
MD5 | 12d5244aa5c7b49cacb483a994462d63 |
|
BLAKE2b-256 | 4224ed5ecce2c00eac4a567272763c830f9bff5375c2ce7b3477004d6f647860 |
Hashes for pyodps-0.8.0-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4832bdae102a6769dee553d410fad7cad47e83735700402f646b0686995ac671 |
|
MD5 | 3804541f939c51fa412f85a070804a53 |
|
BLAKE2b-256 | e7a9629a0ada0c18b3da6e6fafba064c0fb73eaa07cd6d9415c34c2658572af5 |
Hashes for pyodps-0.8.0-cp27-cp27mu-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 724036c4093cc7cc38277fc3aaa23a2e234de8f00eab49eb1d6185fbe4ade578 |
|
MD5 | 18e6ded7443ba214255e08889f3d6bdb |
|
BLAKE2b-256 | 553ccb94e7f0a6f2826b9f23f470d55dbacf44354901e693115ab280d18243a9 |
Hashes for pyodps-0.8.0-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 612cf67e77ed4a8a73b6a8a8a44fee151334040b3874da274c91c24c8e12375a |
|
MD5 | 2fe3bc876e629e2259e2ad98cf450968 |
|
BLAKE2b-256 | 5865316ef2b9f4e6345254d93f672db314341ee5296f1fd748b4698b45db0ba8 |
Hashes for pyodps-0.8.0-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 320abf2fdf16d38aeca681a6833dc87682f4aabbd087ceb8ef61246ffcabe254 |
|
MD5 | 9c873e3e52ec671fb44462c03e16e9ff |
|
BLAKE2b-256 | afcf3c9a03da75aaf8cf816794d2b4509d0b8c92e7a4c0aa181554f851d2894a |
Hashes for pyodps-0.8.0-cp27-cp27m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d2418c294b60f9f2db81f6ea277912c008858e878803253b78ef4f95e3fd23aa |
|
MD5 | 828c3f8bd248c1cdf7e6d5a9e5f62583 |
|
BLAKE2b-256 | 2eb3c69d6ca446f6947de6c5cfb5b053d9c27eb0f1caf9d8d06c908376e2fe37 |
Hashes for pyodps-0.8.0-cp27-cp27m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5dea7230cf5ffdb9a4a105a087261db7bde5d6a1601a0f05486e943ffde92b6b |
|
MD5 | d5506af905d810ad6cc1153e1e6d5293 |
|
BLAKE2b-256 | 1043a6978a4b8d42617626edec01f66f9b098d8f6118295a39022c01096caf31 |
Hashes for pyodps-0.8.0-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 | f0d85d4309a6b98e4f1188e18029cb7292f1c5ce261f28ebbdfd5befe0c00198 |
|
MD5 | ed66ec7d1c422f388aaba620a1273694 |
|
BLAKE2b-256 | de094fc3c3898eeda9bbd5e9848447591992b2759cd3f2bc918507b393d12120 |