Skip to content

Conversation

Nithurshen
Copy link
Contributor

This pull request addresses a ValueError that occurs when calling Series.info(show_counts=False).

The root cause of the bug was in the _SeriesTableBuilderVerbose._gen_rows_without_counts method, which was incorrectly yielding a raw string for the Dtype (e.g., 'int64') instead of a sequence (e.g., ['int64']). A downstream formatting function then attempted to zip() this string, treating it as a sequence of characters, which led to an argument length mismatch and raised the ValueError.

The fix ensures the method yields the Dtype string wrapped in a list, providing the correct data structure and preventing the crash.

@santhoshbethi
Copy link
Contributor

Hi @Nithurshen ,
I am seeing formatting error at

def test_query_duplicate_column_name(self, engine, parser):
)

Currently I am testing my local environment and when I do ruff format --check . I saw you pushed changes and it worked fine. Could you check this once when you have some time. Thanks

@Nithurshen
Copy link
Contributor Author

Hi @Nithurshen , I am seeing formatting error at

def test_query_duplicate_column_name(self, engine, parser):

)
Currently I am testing my local environment and when I do ruff format --check . I saw you pushed changes and it worked fine. Could you check this once when you have some time. Thanks

Is it due to my commits? Or is it another bug?

@Nithurshen
Copy link
Contributor Author

Sorry for the confusion. I think it is bug. I am just wondering is it happening only to me or did you face such issue?

First of all, thank you for verifying my commits.

Second, if you feel it is a bug, then please open an issue and I'm more than happy to work on it.

@santhoshbethi
Copy link
Contributor

Sure, Thanks. I worked on it.

Copy link
Contributor

@Dr-Irv Dr-Irv left a comment

Choose a reason for hiding this comment

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

You need to add a test for the case that failed in tests/series/test_info.py

@Nithurshen
Copy link
Contributor Author

Added a test in pandas/tests/series/methods/test_info.py file.

Test code:

def test_info_show_counts_false():
    # GH#62590
    s = Series([1, 2, None])
    buf = StringIO()
    s.info(buf=buf, show_counts=False)
    result = buf.getvalue()
    assert "Non-Null Count" not in result
    assert "<class 'pandas.Series'>" in result
    assert "Dtype" in result

@Nithurshen Nithurshen requested a review from Dr-Irv October 16, 2025 01:32
@Dr-Irv Dr-Irv merged commit 59a977b into pandas-dev:main Oct 16, 2025
42 checks passed
cmp0xff added a commit to cmp0xff/pandas-stubs that referenced this pull request Oct 16, 2025
Dr-Irv pushed a commit to pandas-dev/pandas-stubs that referenced this pull request Oct 17, 2025
eicchen pushed a commit to eicchen/pandas that referenced this pull request Oct 18, 2025
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: In main, pd.Series(show_counts=False) is broken

3 participants