Skip to content

Commit 78f3d18

Browse files
committed
clean upformatting
1 parent 9738de9 commit 78f3d18

File tree

1 file changed

+11
-7
lines changed
  • src/nested_pandas/nestedframe

1 file changed

+11
-7
lines changed

src/nested_pandas/nestedframe/core.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import ast
55
import os
66
import re
7-
import io
87

98
import numpy as np
109
import pandas as pd
@@ -290,7 +289,9 @@ def _repr_html_(self) -> str | None:
290289
# first cell shows the nested df header and a preview row
291290
def repack_first_cell(chunk):
292291
# Render header separately to keep data aligned
293-
output = chunk.head(0).to_html(max_rows=0, max_cols=5, show_dimensions=False, index=False, header=True)
292+
output = chunk.head(0).to_html(
293+
max_rows=0, max_cols=5, show_dimensions=False, index=False, header=True
294+
)
294295
# Then add a preview row
295296
output += repack_row(chunk)
296297
return output
@@ -300,13 +301,17 @@ def repack_row(chunk):
300301
return chunk.to_html(max_rows=1, max_cols=5, show_dimensions=True, index=False, header=False)
301302

302303
# Apply repacking to all nested columns
303-
repr = self.style.format({col: repack_first_cell for col in self.nested_columns}, subset=self.index[0])
304-
repr = repr.format({col: repack_row for col in self.nested_columns}, subset=pd.IndexSlice[self.index[1]:])
304+
repr = self.style.format(
305+
{col: repack_first_cell for col in self.nested_columns}, subset=self.index[0]
306+
)
307+
repr = repr.format(
308+
{col: repack_row for col in self.nested_columns}, subset=pd.IndexSlice[self.index[1] :]
309+
)
305310

306311
# Recover some truncation formatting, limited to head truncation
307312
# Use half of pandas sizes to account for large row height
308-
if repr.data.shape[0] > pd.get_option("display.max_rows")//2:
309-
html_repr = repr.to_html(max_rows=pd.get_option("display.min_rows")//2)
313+
if repr.data.shape[0] > pd.get_option("display.max_rows") // 2:
314+
html_repr = repr.to_html(max_rows=pd.get_option("display.min_rows") // 2)
310315
else:
311316
html_repr = repr.to_html(max_rows=0)
312317

@@ -315,7 +320,6 @@ def repack_row(chunk):
315320

316321
return html_repr
317322

318-
319323
def _parse_hierarchical_components(self, delimited_path: str, delimiter: str = ".") -> list[str]:
320324
"""
321325
Given a string that may be a delimited path, parse it into its components,

0 commit comments

Comments
 (0)