Skip to content

Commit 35a5842

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 24b7893 commit 35a5842

File tree

2 files changed

+25
-26
lines changed

2 files changed

+25
-26
lines changed

pandas/io/formats/info.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -494,28 +494,28 @@ def non_null_counts(self) -> Series:
494494
def memory_usage_bytes(self) -> int:
495495
deep = self.memory_usage == "deep"
496496
return self.data.memory_usage(index=True, deep=deep).sum()
497-
497+
498498
def to_dict(self) -> dict:
499499
"""Return DataFrame info as a dictionary."""
500500
return {
501-
'Column_summary': self._get_column_summary(),
502-
'Memory_usage': self.memory_usage_bytes,
503-
'Index_type': type(self.data.index).__name__,
504-
'Index_entries': len(self.data.index),
501+
"Column_summary": self._get_column_summary(),
502+
"Memory_usage": self.memory_usage_bytes,
503+
"Index_type": type(self.data.index).__name__,
504+
"Index_entries": len(self.data.index),
505505
}
506506

507507
def _get_column_summary(self) -> list[dict]:
508508
"""Return a DataFrame summarizing columns."""
509509
return [
510510
{
511-
'#': i,
512-
'Column': col,
513-
'Non-Null-Count': self.data[col].notna().sum(),
514-
'Dtype': self.data[col].dtype
511+
"#": i,
512+
"Column": col,
513+
"Non-Null-Count": self.data[col].notna().sum(),
514+
"Dtype": self.data[col].dtype,
515515
}
516516
for i, col in enumerate(self.ids)
517517
]
518-
518+
519519
def render(
520520
self,
521521
*,

pandas/tests/frame/methods/test_info.py

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -570,27 +570,26 @@ def test_info_show_counts(row, columns, show_counts, result):
570570
df.info(buf=buf, show_counts=show_counts)
571571
assert ("non-null" in buf.getvalue()) is result
572572

573+
573574
@pytest.mark.parametrize(
574-
"df", [
575-
DataFrame({
576-
'A': [1, 2, 3],
577-
'B': [4, 5, 6]
578-
}),
575+
"df",
576+
[
577+
DataFrame({"A": [1, 2, 3], "B": [4, 5, 6]}),
579578
DataFrame({}),
580-
]
579+
],
581580
)
582581
def test_info_return_dict(df):
583582
result = df.info(return_dict=True)
584-
expected_keys = {'Column_summary', 'Memory_usage', 'Index_type', 'Index_entries'}
583+
expected_keys = {"Column_summary", "Memory_usage", "Index_type", "Index_entries"}
585584
assert isinstance(result, dict)
586585
assert expected_keys.issubset(result.keys())
587586

588-
assert 'Column_summary' in result
589-
assert 'Memory_usage' in result
590-
assert 'Index_type' in result
591-
assert 'Index_entries' in result
592-
593-
assert isinstance(result['Column_summary'], list)
594-
assert isinstance(result['Memory_usage'], np.int64)
595-
assert isinstance(result['Index_type'], str)
596-
assert isinstance(result['Index_entries'], int)
587+
assert "Column_summary" in result
588+
assert "Memory_usage" in result
589+
assert "Index_type" in result
590+
assert "Index_entries" in result
591+
592+
assert isinstance(result["Column_summary"], list)
593+
assert isinstance(result["Memory_usage"], np.int64)
594+
assert isinstance(result["Index_type"], str)
595+
assert isinstance(result["Index_entries"], int)

0 commit comments

Comments
 (0)