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

Groupby.apply results are transposed when apply function returns Series #1682

Closed
gshimansky opened this issue Jul 1, 2020 · 2 comments
Closed
Assignees
Labels
bug 🦗 Something isn't working

Comments

@gshimansky
Copy link
Collaborator

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04):

Ubuntu 20.04

  • Modin version (modin.__version__):

0.7.3+167.gc685f41.dirty

  • Python version:

Python 3.8.2

  • Code we can use to reproduce:
import modin.pandas as pd
import numpy as np

df = pd.DataFrame(
    {
        "col1": ["a", "a", "a", "b", "b", "c", "c", "c"],
        "col2": [10, 20, 30, 40, 50, 60, 70, 80],
    })

def func(data):
    return pd.Series([111.11, 222.22])

print(df)
gb = df.groupby("col1")
print(gb.groups)
for col, frame in gb:
    print("Frame for col", col)
    print(frame)

df1 = gb.apply(func)
print(df1)
print(df1.shape)

Describe the problem

On Pandas there should be a DataFrame with contents like this

           0       1
col1
a     111.11  222.22
b     111.11  222.22
c     111.11  222.22

and shape (3, 2) but on Modin index goes into columns and Series contents appear in every cell:

col1                 a                 b                 c
col1
0     [111.11, 222.22]  [111.11, 222.22]  [111.11, 222.22]

This bug is related to #1587.

Source code / logs

@gshimansky
Copy link
Collaborator Author

gshimansky commented Oct 23, 2020

Would it help to wrap user function in wrap_udf_function to cast Modin type to Pandas?

@mvashishtha
Copy link
Collaborator

@gshimansky On Modin version 0.11.1+9.g5e13fec, the code from your first comment produces a dataframe with shape (3, 2) as expected. I'm closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🦗 Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants