From eb64ff670bf825b320f52ea6958678db8419083c Mon Sep 17 00:00:00 2001 From: Isaiah Norton Date: Thu, 10 Jun 2021 22:19:38 -0400 Subject: [PATCH] Relax from_pandas 'append' requirement for 'row_start_index' If the array is sparse then we don't need to require 'row_start_idx'. --- tiledb/dataframe_.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/tiledb/dataframe_.py b/tiledb/dataframe_.py index ca7e60a735..7a5e68aa05 100644 --- a/tiledb/dataframe_.py +++ b/tiledb/dataframe_.py @@ -290,13 +290,7 @@ def _sparse_from_dtypes(dtypes, sparse=None): return sparse if sparse is not None else False -def create_dims( - df, - index_dims, - tile=None, - full_domain=False, - filters=None, -): +def create_dims(df, index_dims, tile=None, full_domain=False, filters=None): per_dim_tile = isinstance(tile, dict) if tile is not None: tile_values = tile.values() if per_dim_tile else (tile,) @@ -441,7 +435,8 @@ def from_pandas(uri, dataframe, **kwargs): write = False elif mode == "append": create_array = False - if not sparse and row_start_idx is None: + schema = tiledb.ArraySchema.load(uri) + if not schema.sparse and row_start_idx is None: raise TileDBError( "Cannot append to dense array without 'row_start_idx'" )