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] DataFrame.from_dict incorrectly sets index values as data values from nested dicts #14096

Closed
mroeschke opened this issue Sep 12, 2023 · 0 comments · Fixed by #14119
Closed
Assignees
Labels
bug Something isn't working Python Affects Python cuDF API.

Comments

@mroeschke
Copy link
Contributor

Describe the bug
DataFrame.from_dict incorrectly sets index values as data values from nested dicts

Steps/Code to reproduce bug

In [10]: import cudf

In [11]: import pandas as pd

In [13]: from collections import OrderedDict

In [14]:         a = OrderedDict(
    ...:             [
    ...:                 ("one", OrderedDict([("col_a", "foo1"), ("col_b", "bar1")])),
    ...:                 ("two", OrderedDict([("col_a", "foo2"), ("col_b", "bar2")])),
    ...:                 ("three", OrderedDict([("col_a", "foo3"), ("col_b", "bar3")])),
    ...:             ]
    ...:         )

In [15]: cudf.DataFrame.from_dict(a, orient="columns")
Out[15]: 
     one    two  three
0  col_a  col_a  col_a
1  col_b  col_b  col_b

In [16]: pd.DataFrame.from_dict(a, orient="columns")
Out[16]: 
        one   two three
col_a  foo1  foo2  foo3
col_b  bar1  bar2  bar3

Expected behavior
Out[16]

Environment overview (please complete the following information)

  • Environment location: Bare-metal
  • Method of cuDF install: conda
@mroeschke mroeschke added bug Something isn't working Python Affects Python cuDF API. labels Sep 12, 2023
@galipremsagar galipremsagar self-assigned this Sep 18, 2023
rapids-bot bot pushed a commit that referenced this issue Sep 18, 2023
Fixes: #14096 

This PR enables nested dict initialization support in `DataFrame` constructor.

Authors:
  - GALI PREM SAGAR (https://github.com/galipremsagar)

Approvers:
  - Matthew Roeschke (https://github.com/mroeschke)

URL: #14119
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Python Affects Python cuDF API.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants