pandas-dev / pandas

Flexible and powerful data analysis / manipulation library for Python, providing labeled data structures similar to R data.frame objects, statistical functions, and much more
https://pandas.pydata.org
BSD 3-Clause "New" or "Revised" License
43.83k stars 18k forks source link

Bug Fix: #60343 Construction of Series / Index fails from dict keys when "str" dtype is specified explicitly #60383

Open tasfia8 opened 1 day ago

tasfia8 commented 1 day ago

To fix the issue:

After the fix both the default (pd.Index(d.keys())) and explicit (pd.Index(d.keys(), dtype="str")) cases work:

Screenshot 2024-11-19 at 3 17 08 AM
tasfia8 commented 1 day ago

Hi, I'm a student contributing to this PR and am on bit of a time crunch due to finals. For my school project, my task is to merge the PR as quickly as possible with the help and guidance of maintainers. I was able to fix the bug but I am a bit stuck on how to fix the checks. Could @jorisvandenbossche or anyone else help? Especially the unit tests ones. I tried to fix the pre-commit (using ruff lint fix) but every time I fixed a formatting issue, after running pre-commit it goes to the initial position before I did the fix.

For the Doc build and upload check (it was giving an error for every declaration of ipython that didn't have import pandas as pd), I manually inserted it but don't know if there is an easy way.