Skip to content

Commit

Permalink
Fix size passed to column constructors in _with_type_metadata (#8539)
Browse files Browse the repository at this point in the history
Authors:
  - Ashwin Srinath (https://github.com/shwina)

Approvers:
  - Charles Blackmon-Luca (https://github.com/charlesbluca)
  - Marlene  (https://github.com/marlenezw)

URL: #8539
  • Loading branch information
shwina authored Jun 18, 2021
1 parent 90fe10b commit 45626b6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion python/cudf/cudf/core/column/lists.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def _with_type_metadata(
dtype.element_type
),
mask=self.base_mask,
size=self.base_size,
size=self.size,
offset=self.offset,
null_count=self.null_count,
)
Expand Down
4 changes: 2 additions & 2 deletions python/cudf/cudf/core/column/struct.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def _rename_fields(self, names):
)
return StructColumn(
data=None,
size=self.base_size,
size=self.size,
dtype=dtype,
mask=self.base_mask,
offset=self.offset,
Expand All @@ -122,7 +122,7 @@ def _with_type_metadata(self: StructColumn, dtype: Dtype) -> StructColumn:
for i, f in enumerate(dtype.fields.keys())
),
mask=self.base_mask,
size=self.base_size,
size=self.size,
offset=self.offset,
null_count=self.null_count,
)
Expand Down
4 changes: 4 additions & 0 deletions python/cudf/cudf/tests/test_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1401,6 +1401,10 @@ def test_iloc_with_lists(data, key):
gsr = cudf.Series(data)
assert_eq(psr.iloc[key], gsr.iloc[key])

pdf = pd.DataFrame({"a": data, "b": data})
gdf = cudf.DataFrame({"a": data, "b": data})
assert_eq(pdf.iloc[key], gdf.iloc[key])


@pytest.mark.parametrize("key", [5, -10, "0", "a", np.array(5), np.array("a")])
def test_loc_bad_key_type(key):
Expand Down

0 comments on commit 45626b6

Please sign in to comment.