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.14-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c6a43001b26d7dae768e3424c7e218fac57170e4ff7d903ca6728679b0f7061d |
|
MD5 | 0780b7cc28a8bc9134982fa869ffb841 |
|
BLAKE2b-256 | af7fd9893a79f0c36eb56b9287875606fc2831e7faaa5046d59919e8bed28de7 |
Hashes for pyodps-0.7.14-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd050b53df25086ca936881edc639eaed06d065aadcbb288f19dfa7a5d2a2f23 |
|
MD5 | 3afe75c3ad99d2e1368cb93837178bbf |
|
BLAKE2b-256 | ac1046518ca385fddd8d16912def89967c587d59bd312e5f7f297c726cf610de |
Hashes for pyodps-0.7.14-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a21545103c7b02861329a7e401ab21fbd5be7c74919a11bf6808b87161b14a24 |
|
MD5 | 041a0e5ee6c11b6b220cff00a79e81fe |
|
BLAKE2b-256 | 5d820d546a981555816f9b17fa93cf820d3234b78fab22e04b07223b1bc29bb9 |
Hashes for pyodps-0.7.14-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 243544cc82f791019a137a788bbf6f07e7b7e96193d8a223eb28ec420fa9b454 |
|
MD5 | 627ee23c6fecc2483052507d3a67bbcc |
|
BLAKE2b-256 | 46db8952d33fd92a9b9b77ca1c69cd8cad6a511b2d473fafe96ea5b24adf19b6 |
Hashes for pyodps-0.7.14-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 | c16d757f5c3237105a21fdcb9891636dd7cf9af46045c63c63b7bd183fda6398 |
|
MD5 | 1ddc08e5b650439d3b942ad59ce314c7 |
|
BLAKE2b-256 | 7d276283ffd64e85aafa492f6753bfece6a77f4bd29d1c63f4299ce1fb56fed6 |
Hashes for pyodps-0.7.14-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7eb15edc9331330564e77c8f47844a1e60cf99290735b102f5f4d80dcf53fa14 |
|
MD5 | 952d07d8b6c537d699af8f87ce4f43df |
|
BLAKE2b-256 | f29a04ce50f9cd45ba9c52d0f35b80d1b08bb6540cdc38c91b4c225c41df71cb |
Hashes for pyodps-0.7.14-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f73b46ee7cb5eb7316569258e197cc65c5ce345d3cc8abfe4c8e048ed5dae6f8 |
|
MD5 | 3d29765b0b04936fdcafa884271b9409 |
|
BLAKE2b-256 | 7bde22c76e1e9498993200e82daf8297917fbc01cde24e423f46a1f9806dd025 |
Hashes for pyodps-0.7.14-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 948469b7a74ccc46ba122c5fccde976f4bf09c9d76391c905819edc264b039db |
|
MD5 | 5789955947caa95bb74075b5797ca0ad |
|
BLAKE2b-256 | 2f0b3b1fda8218e57488f71bd0dea1edab512907aecb6533100a23eb3b3d09f9 |
Hashes for pyodps-0.7.14-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b0e5b778ef765c77b8b257d6a17d29e9f26a6d578e5ea7769d818e85a270e0a9 |
|
MD5 | 5e2702656654f2eae921a6f64160c656 |
|
BLAKE2b-256 | a655d87c5ad06017f21a1be757ae9445ac7884049e5a237dda9d8f95ab64272a |
Hashes for pyodps-0.7.14-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 | 686653796000171172a4f775ee9b6bafb07038962e0f1db1565055325d11d945 |
|
MD5 | 3466b0630c2785d8a924e045eb694167 |
|
BLAKE2b-256 | d7f4172636ebb50ad4747851fbdc3aee0aa83db8b68c52e1ee61a88c5e6cc9f1 |
Hashes for pyodps-0.7.14-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 61da66b0ffa25f764a1894725ae6c7fba264753acaa1a4e81b8043d37958b988 |
|
MD5 | 25cb3a036b64850b53c6491eefdffd10 |
|
BLAKE2b-256 | e090b48db86badaf50d1e3f7cdb6492437f51f58cc64667e8047152d0667a193 |
Hashes for pyodps-0.7.14-cp27-cp27mu-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c634ee06e0c14abe5916689ecd3b8c1f77e2e3cbce1959ea9f84c0cf52c5758e |
|
MD5 | c575244e419b86e120e4646657d783a2 |
|
BLAKE2b-256 | 2f1151b333501e7441ab30c2946616afd18d71124e4e27ae5312d0a061d4bffb |
Hashes for pyodps-0.7.14-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f6e5b4dd4de8ca0fe448f38cbe0d2997c0e03424e4616c87c08bc5035de0c4b |
|
MD5 | a7492d8c67855f9eae3188213979703d |
|
BLAKE2b-256 | d85bbacceca705ff03f2a03a6c52393c8f98d183c62e14d17cbdea8f4878dc20 |
Hashes for pyodps-0.7.14-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef70872b215a647d1f6eb2dd51b549ed0f4b0fd7912b56820ff20e1e095a0d07 |
|
MD5 | 9fdbea7030bcb4df099be369de057788 |
|
BLAKE2b-256 | b510748263dcf2b5158ab99f98f2b5c665a5ed6463b76f2732ebfb6500890caf |
Hashes for pyodps-0.7.14-cp27-cp27m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d2a97da7d941d558d4057d3d697e2e85f94ada6eb255cd4a722fd01c21cddfa7 |
|
MD5 | 5b0ff8925113084585ed1b82bb029bfc |
|
BLAKE2b-256 | e6997ee6296dbb00f5f9ec874948f87111850ec0a2e1832d46c0c141b14eea79 |
Hashes for pyodps-0.7.14-cp27-cp27m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 10a49028be44f91b1950f7c333615439c9030f61ee6359b5005e36002188b588 |
|
MD5 | 46c2df23bc07138879d0b20b7b48e56e |
|
BLAKE2b-256 | f61554bc17c81eb338d8d78939b579b6f4713abf189d3401b78c2e1c27680489 |
Hashes for pyodps-0.7.14-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 | 0e64b3c259d22c4f3ac0779313848d1a2364b405760f5d9a5ffa88336d87bdc4 |
|
MD5 | 176f00ee2bd328706a0bbee035b1fbc7 |
|
BLAKE2b-256 | 71a4381f34eb1b282055de8efb013b10c0fb27b61cc0d4e437c2a3fbb997f214 |