Remove redundant empty-frame guard in FocusCsvSerializer

Polars write_csv already handles empty DataFrames correctly (outputs
header-only CSV), so the conditional branch was a no-op.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Harshit28j 2026-03-11 15:16:49 +05:30
parent 230c85313b
commit 9e623ceaff

View file

@ -16,7 +16,6 @@ class FocusCsvSerializer(FocusSerializer):
def serialize(self, frame: pl.DataFrame) -> bytes:
"""Encode the provided frame as a CSV payload."""
target = frame if not frame.is_empty() else pl.DataFrame(schema=frame.schema)
buffer = io.BytesIO()
target.write_csv(buffer)
frame.write_csv(buffer)
return buffer.getvalue()