Skip to content

BUG: Fixes #62775 - DataFrame.from_dict() drops empty rows with orient='index'#65615

Open
J281417 wants to merge 6 commits into
pandas-dev:mainfrom
J281417:issue-62775
Open

BUG: Fixes #62775 - DataFrame.from_dict() drops empty rows with orient='index'#65615
J281417 wants to merge 6 commits into
pandas-dev:mainfrom
J281417:issue-62775

Conversation

@J281417
Copy link
Copy Markdown

@J281417 J281417 commented May 12, 2026

@J281417
Copy link
Copy Markdown
Author

J281417 commented May 12, 2026

Hi my name is Nol,

I'd like to contribute to this issue. Currently, the iteration skips s.values() when its blank. So i've added an explicit assign np.nan. Also, ive added a list of cols so that a row that has no values will be populated with np.nan and maintains expected column sequence.

Please review and provide feedback.

Thank you

@J281417 J281417 marked this pull request as draft May 12, 2026 13:58
@J281417 J281417 marked this pull request as ready for review May 12, 2026 13:59
@mapanahi
Copy link
Copy Markdown
Contributor

@J281417 looks like there are a couple failing tests.

@J281417
Copy link
Copy Markdown
Author

J281417 commented May 14, 2026

Hi @mapanahi,
Yeah, I will update this weekend. Do you know if i should be assigning someone as reviewer for PRs?
Thank you.

@mapanahi
Copy link
Copy Markdown
Contributor

Hi @mapanahi, Yeah, I will update this weekend. Do you know if i should be assigning someone as reviewer for PRs? Thank you.

No. You don't need to assign to anybody. The reviewers periodically look for open PRs.

@J281417
Copy link
Copy Markdown
Author

J281417 commented May 16, 2026

Thanks @mapanahi, Goit it working. Just have to wait for reviewer now.
Have a great weekend!

Copy link
Copy Markdown
Member

@rhshadrach rhshadrach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR but I'm negative on this approach; can you instead do

index = list(data.keys())

where this is called from. That already then flows through to DataFrame construction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: DataFrame.from_dict() drops empty rows with orient='index', inconsistently with empty columns

3 participants