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: series.name is set to None as sideeffect if series is used in an add or substract operation #5232

Closed
2 of 3 tasks
ahallermed opened this issue Nov 17, 2022 · 1 comment · Fixed by #5249
Closed
2 of 3 tasks
Assignees
Labels
bug 🦗 Something isn't working P2 Minor bugs or low-priority feature requests

Comments

@ahallermed
Copy link
Contributor

ahallermed commented Nov 17, 2022

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  # 0.17.0
import pandas  # 1.5.1

# %% pandas
series_1 = pandas.Series([1, 2, 3], name="a")
series_2 = pandas.Series([3, 2, 1], name="b")
series_1 - series_2
print(series_1.name)  # "a"
print(series_2.name)  # "b"

# modin.pandas removes the series names
# %% modin.pandas - substract
series_1 = pd.Series([1, 2, 3], name="a")
series_2 = pd.Series([3, 2, 1], name="b")
series_1 - series_2
print(series_1.name)  # None instead of expected "a"
print(series_2.name)  # None instead of expected "b"


# Additional other tests which showed same results


# %% modin.pandas - substract
series_1 = pd.Series([1, 2, 3], name="a")
series_2 = pd.Series([3, 2, 1], name="b")
series_1.subtract(series_2)
print(series_1.name)  # None instead of expected "a"
print(series_2.name)  # None instead of expected "b"

# %% modin.pandas - add
series_1 = pd.Series([1, 2, 3], name="a")
series_2 = pd.Series([3, 2, 1], name="b")
series_1 + series_2
print(series_1.name)  # None instead of expected "a"
print(series_2.name)  # None instead of expected "b"

# Still correct for DataFrame
# %%
df = pandas.DataFrame({"a": [1, 2, 3]})
df - df
print(df.columns.to_list())
# %%
df = pd.DataFrame({"a": [1, 2, 3]})
df - df
print(df.columns.to_list())

Issue Description

If a series is used within an add or substract operation series + other_series, the series and other_series get modified in a way that their name is removed.

Expected Behavior

The expected behaviour is the one from pandas, where the name of each series in an operation stays preserved.

import modin.pandas as pd
series_1 = pd.Series([1, 2, 3], name="a")
series_2 = pd.Series([3, 2, 1], name="b")
series_1 - series_2
print(series_1.name)  # "a"
print(series_2.name)  # "b"

Error Logs

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

Installed Versions

INSTALLED VERSIONS

commit : e50cec1
python : 3.8.10.final.0
python-bits : 64
OS : Linux
OS-release : 5.15.0-10052-tuxedo
Version : #58~20.04.1tux1 SMP Mon Oct 24 12:05:31 UTC 2022
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8

Modin dependencies

modin : 0.17.0
ray : 1.12.1
dask : None
distributed : None
hdk : None

pandas dependencies

pandas : 1.5.1
numpy : 1.23.4
pytz : 2022.6
dateutil : 2.8.2
setuptools : 65.5.0
pip : 21.1.3
Cython : None
pytest : 7.2.0
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.1.2
IPython : 8.6.0
pandas_datareader: None
bs4 : 4.11.1
bottleneck : None
brotli : None
fastparquet : None
fsspec : 2022.11.0
gcsfs : None
matplotlib : 3.5.3
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : 1.9.3
snappy : None
sqlalchemy : 1.3.24
tables : None
tabulate : 0.9.0
xarray : None
xlrd : None
xlwt : None
zstandard : None
tzdata : None

@ahallermed ahallermed added bug 🦗 Something isn't working Triage 🩹 Issues that need triage labels Nov 17, 2022
@pyrito pyrito added P2 Minor bugs or low-priority feature requests and removed Triage 🩹 Issues that need triage labels Nov 18, 2022
@pyrito
Copy link
Collaborator

pyrito commented Nov 18, 2022

@ahallermed thanks for opening the issue! I was able to reproduce the issue on the latest Modin commit. We'll take a closer look at the problem and open a fix soon!

@mvashishtha mvashishtha self-assigned this Nov 22, 2022
mvashishtha pushed a commit to mvashishtha/modin that referenced this issue Nov 24, 2022
…nary ops.

Signed-off-by: mvashishtha <mahesh@ponder.io>
anmyachev added a commit that referenced this issue Nov 24, 2022
)

Signed-off-by: mvashishtha <mahesh@ponder.io>
Co-authored-by: Anatoly Myachev <anatoliimyachev@mail.com>
dchigarev pushed a commit that referenced this issue Nov 25, 2022
)

Signed-off-by: mvashishtha <mahesh@ponder.io>
Co-authored-by: Anatoly Myachev <anatoliimyachev@mail.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.

3 participants