Skip to content

Commit

Permalink
[DataFrame] Update initializations of IndexMetadata which use outdate…
Browse files Browse the repository at this point in the history
…d APIs (ray-project#2103)

* Update calls which use outdated APIs

* Fix lengths of IndexMetadata
  • Loading branch information
pschafhalter authored and devin-petersohn committed May 21, 2018
1 parent eb07876 commit f1fc373
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions python/ray/dataframe/indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,18 @@ def _retrive_items(self, row_lookup, col_lookup):
def _generate_view(self, row_lookup, col_lookup):
"""Generate a DataFrameView from lookup
"""
row_lengths = [0] * len(self.df._row_metadata._lengths)
for i in row_lookup["partition"]:
row_lengths[i] += 1
col_lengths = [0] * len(self.df._col_metadata._lengths)
for i in col_lookup["partition"]:
col_lengths[i] += 1

row_metadata_view = _IndexMetadata(
_coord_df=row_lookup, _lengths=self.df._row_metadata._lengths)
coord_df_oid=row_lookup, lengths_oid=row_lengths)

col_metadata_view = _IndexMetadata(
_coord_df=col_lookup, _lengths=self.df._col_metadata._lengths)
coord_df_oid=col_lookup, lengths_oid=col_lengths)

df_view = DataFrameView(
block_partitions=self.block_oids,
Expand Down Expand Up @@ -354,7 +361,7 @@ def _enlarge_axis(self, locator, axis):
lens = major_meta._lengths
lens = np.concatenate([lens, np.array([num_nan_labels])])

metadata_view = _IndexMetadata(_coord_df=coord_df, _lengths=lens)
metadata_view = _IndexMetadata(coord_df_oid=coord_df, lengths_oid=lens)
return metadata_view

def _compute_enlarge_labels(self, locator, base_index):
Expand Down

0 comments on commit f1fc373

Please sign in to comment.