Skip to content

Commit

Permalink
Fix writing HTML dataframe header when not all columns should be shown.
Browse files Browse the repository at this point in the history
  • Loading branch information
ghuls authored and ritchie46 committed Jan 19, 2022
1 parent 24bdcbc commit f91f0a4
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions py-polars/polars/_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,21 @@ def write_header(self) -> None:
"""
with Tag(self.elements, "thead"):
with Tag(self.elements, "tr"):
for col in self.df.columns:
columns = self.df.columns
for c in self.col_idx:
with Tag(self.elements, "th"):
self.elements.append(col)
if c == -1:
self.elements.append("...")
else:
self.elements.append(columns[c])
with Tag(self.elements, "tr"):
for dtype in self.df.dtypes:
ffi_name = dtype_to_ffiname(dtype)
dtypes = self.df.dtypes
for c in self.col_idx:
with Tag(self.elements, "td"):
self.elements.append(ffi_name)
if c == -1:
self.elements.append("...")
else:
self.elements.append(dtype_to_ffiname(dtypes[c]))

def write_body(self) -> None:
"""
Expand Down

0 comments on commit f91f0a4

Please sign in to comment.