Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs update: clarify, add missing functions, misc fixes #368

Merged
merged 1 commit into from
Jul 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# -- Project information -----------------------------------------------------

project = 'TileDB-Py'
copyright = '2019, TileDB, Inc.'
copyright = '2020, TileDB, Inc.'
author = 'TileDB, Inc.'

# The short X.Y version
Expand Down
16 changes: 16 additions & 0 deletions doc/source/python-api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@ There is also a submodule ``libtiledb`` which contains the necessary bindings to
import tiledb
tiledb.libtiledb.version() # Native TileDB library version number

Data import helpers
-------------------

.. autofunction:: tiledb.from_numpy
.. autofunction:: tiledb.from_csv
.. autofunction:: tiledb.from_pandas

Auxiliary high-level functions
------------------------------

.. autofunction:: tiledb.open
.. autofunction:: tiledb.empty_like

Exceptions
----------

Expand Down Expand Up @@ -98,6 +111,7 @@ Array
:members:

.. autofunction:: tiledb.consolidate
.. autofunction:: tiledb.vacuum

Dense Array
-----------
Expand All @@ -107,6 +121,7 @@ Dense Array

.. automethod:: __getitem__(selection)
.. automethod:: __setitem__(selection, value)
.. automethod:: from_numpy(uri, array, ctx=None, **kwargs)

Sparse Array
------------
Expand All @@ -120,6 +135,7 @@ Sparse Array
Object Management
-----------------

.. autofunction:: tiledb.array_exists
.. autofunction:: tiledb.group_create
.. autofunction:: tiledb.object_type
.. autofunction:: tiledb.remove
Expand Down
47 changes: 26 additions & 21 deletions tiledb/dataframe_.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,10 +319,12 @@ def from_pandas(uri, dataframe, **kwargs):
:param uri: URI for new TileDB array
:param dataframe: pandas DataFrame
:param mode: Creation mode, one of 'ingest' (default), 'schema_only', 'append'
:param kwargs: optional keyword arguments for Pandas and TileDB.
TileDB arguments: tile_order, cell_order, allows_duplicates, sparse,
mode, attrs_filters, coords_filters
:return:

:Keyword Arguments: optional keyword arguments for TileDB, see ``tiledb.from_csv``.

:raises: :py:exc:`tiledb.TileDBError`
:return: None

"""
import pandas as pd

Expand Down Expand Up @@ -500,29 +502,32 @@ def open_dataframe(uri):


def from_csv(uri, csv_file, **kwargs):
"""Create TileDB array at given URI from a CSV file
"""
Create TileDB array at given URI from a CSV file or list of files

:param uri: URI for new TileDB array
:param csv_file: input CSV file or list of CSV files.
Note: multi-file ingestion requires a `chunksize` argument. Files will
be read in batches of at least `chunksize` rows before writing to the
TileDB array.
:param kwargs:
- Any pandas.read_csv supported keyword argument.
- TileDB-specific arguments:
'allows_duplicates': Generated schema should allow duplicates
'cell_order': Schema cell order
'tile_order': Schema tile order
'mode': (default 'ingest'), Ingestion mode: 'ingest', 'schema_only', 'append'
'full_domain': Dimensions should be created with full range of the dtype
'attrs_filters': FilterList to apply to all Attributes
'coords_filters': FilterList to apply to all coordinates (Dimensions)
'sparse': (default True) Create sparse schema
'tile': Schema tiling (capacity)
'date_spec': Dictionary of {'column_name': format_spec} to apply to date/time
columns which are not correctly inferred by pandas 'parse_dates'.
Format must be specified using the Python format codes:
https://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior

:Keyword Arguments:
- Any ``pandas.read_csv`` supported keyword argument.
- TileDB-specific arguments:
* ``allows_duplicates``: Generated schema should allow duplicates
* ``cell_order``: Schema cell order
* ``tile_order``: Schema tile order
* ``mode``: (default ``ingest``), Ingestion mode: ``ingest``, ``schema_only``,
``append``
* ``full_domain``: Dimensions should be created with full range of the dtype
* ``attrs_filters``: FilterList to apply to all Attributes
* ``coords_filters``: FilterList to apply to all coordinates (Dimensions)
* ``sparse``: (default True) Create sparse schema
* ``tile``: Schema tiling (capacity)
* ``date_spec``: Dictionary of {``column_name``: format_spec} to apply to date/time
columns which are not correctly inferred by pandas 'parse_dates'.
Format must be specified using the Python format codes:
https://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior
:return: None

**Example:**
Expand Down
3 changes: 2 additions & 1 deletion tiledb/highlevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ def empty_like(uri, arr, config=None, key=None, tile=None):

def from_numpy(uri, array, ctx=None, **kw):
"""
Convenience method, see `tiledb.DenseArray.from_numpy`
Convenience method to create a TileDB array from a Numpy array.
See documentation of :func:`tiledb.DenseArray.from_numpy`.
"""
if not ctx:
ctx = default_ctx()
Expand Down
Loading