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

[gpuCI] Forward-merge branch-21.12 to branch-22.02 [skip gpuci] #9700

Merged
merged 1 commit into from
Nov 16, 2021
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
20 changes: 13 additions & 7 deletions python/cudf/cudf/core/multiindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -1422,15 +1422,21 @@ def _clean_nulls_from_index(self):
)

def memory_usage(self, deep=False):
if deep:
warnings.warn(
"The deep parameter is ignored and is only included "
"for pandas compatibility."
)

n = 0
for col in self._data._columns:
n += col._memory_usage(deep=deep)
if self._levels:
for level in self._levels:
for col in self._data.columns:
n += col.memory_usage()
if self.levels:
for level in self.levels:
n += level.memory_usage(deep=deep)
if self._codes:
for col in self._codes._columns:
n += col._memory_usage(deep=deep)
if self.codes:
for col in self.codes._data.columns:
n += col.memory_usage()
return n

def difference(self, other, sort=None):
Expand Down
6 changes: 2 additions & 4 deletions python/cudf/cudf/tests/test_dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -5406,9 +5406,8 @@ def test_memory_usage_list():
assert expected == df.A.memory_usage()


@pytest.mark.xfail
def test_memory_usage_multi():
rows = int(100)
@pytest.mark.parametrize("rows", [10, 100])
def test_memory_usage_multi(rows):
deep = True
df = pd.DataFrame(
{
Expand All @@ -5418,7 +5417,6 @@ def test_memory_usage_multi():
}
).set_index(["B", "C"])
gdf = cudf.from_pandas(df)

# Assume MultiIndex memory footprint is just that
# of the underlying columns, levels, and codes
expect = rows * 16 # Source Columns
Expand Down