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

BUG: .dtypes are not copied on df.copy(deep=True) #5600

Closed
3 tasks done
dchigarev opened this issue Jan 31, 2023 · 0 comments · Fixed by #5601
Closed
3 tasks done

BUG: .dtypes are not copied on df.copy(deep=True) #5600

dchigarev opened this issue Jan 31, 2023 · 0 comments · Fixed by #5601
Assignees
Labels
bug 🦗 Something isn't working P2 Minor bugs or low-priority feature requests

Comments

@dchigarev
Copy link
Collaborator

Modin version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest released version of Modin.

  • I have confirmed this bug exists on the main branch of Modin. (In order to do this you can follow this guide.)

Reproducible Example

import modin.pandas as pd

df = pd.DataFrame({"a": [1, 2]})
df_renamed = df.rename(columns={"a": "new_a"}, copy=True, inplace=False)

# both `.dtypes` has changed
print(df_renamed.dtypes) # new_a: int64
print(df.dtypes) # new_a: int64

Issue Description

The PandasDataframe logic doesn't copy .dtypes as it should:

return self.__constructor__(
self._partitions,
self._index_cache.copy() if self._index_cache is not None else None,
self._columns_cache.copy() if self._columns_cache is not None else None,
self._row_lengths_cache,
self._column_widths_cache,
self._dtypes,
)

Expected Behavior

df.dtypes is df.copy().dtypes == False

Error Logs

Replace this line with the error backtrace (if applicable).

Installed Versions

Replace this line with the output of pd.show_versions()

@dchigarev dchigarev added bug 🦗 Something isn't working P2 Minor bugs or low-priority feature requests Triage 🩹 Issues that need triage labels Jan 31, 2023
@dchigarev dchigarev self-assigned this Jan 31, 2023
@dchigarev dchigarev removed the Triage 🩹 Issues that need triage label Jan 31, 2023
dchigarev added a commit to dchigarev/modin that referenced this issue Jan 31, 2023
Signed-off-by: Dmitry Chigarev <dmitry.chigarev@intel.com>
@dchigarev dchigarev changed the title BUG: .dtypes are not copied on df.copy() BUG: .dtypes are not copied on df.copy(deep=True) Jan 31, 2023
anmyachev pushed a commit that referenced this issue Feb 2, 2023
Signed-off-by: Dmitry Chigarev <dmitry.chigarev@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🦗 Something isn't working P2 Minor bugs or low-priority feature requests
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant