Skip to content

Commit 1a64640

Browse files
Handle case where appending to empty array fails in _concat_and_rewrite. (pandas-dev#402)
1 parent 32df085 commit 1a64640

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

arctic/store/_ndarray_store.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,8 @@ def _concat_and_rewrite(self, collection, version, symbol, item, previous_versio
331331
# We want to stop iterating when we find the first uncompressed chunks
332332
if not segment['compressed']:
333333
# We include the last chunk in the recompression
334-
unchanged_segment_ids.pop()
334+
if unchanged_segment_ids:
335+
unchanged_segment_ids.pop()
335336
break
336337
unchanged_segment_ids.append(segment)
337338

tests/integration/store/test_version_store.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -957,3 +957,19 @@ def test_date_range_large(library):
957957
library.write('test', df)
958958
r = library.read('test', date_range=DateRange(dt(2017,1,1), dt(2017,1,2)))
959959
assert_frame_equal(df, r.data)
960+
961+
962+
def test_append_after_empty(library):
963+
len_df = 500
964+
index = [dt(2017, 1, 2)] * len_df
965+
data = np.random.random((len_df, 10))
966+
df = pd.DataFrame(index=index, data=data)
967+
df.index.name = 'index'
968+
df.columns = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']
969+
library.write(symbol, df.iloc[:0])
970+
971+
for i in range(len_df):
972+
library.append(symbol, df.iloc[i:i + 1])
973+
r = library.read(symbol)
974+
assert_frame_equal(df, r.data)
975+

0 commit comments

Comments
 (0)