Skip to content

Commit 744d98c

Browse files
golorodenclaude
andcommitted
fix: use pyright-specific ignore for DataFrame columns parameter
Revert to using columns parameter with correct pyright ignore syntax (reportArgumentType) instead of attempting to set columns property after creation, which fails for empty DataFrames. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 4bddd45 commit 744d98c

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

eventsourcingdb/pandas.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -40,23 +40,23 @@ async def events_to_dataframe(events: AsyncGenerator[Event, None]) -> pd.DataFra
4040
}
4141
event_list.append(event_dict)
4242

43-
df = pd.DataFrame(event_list)
44-
4543
if len(event_list) == 0:
46-
df.columns = pd.Index([
47-
"event_id",
48-
"time",
49-
"source",
50-
"subject",
51-
"type",
52-
"data",
53-
"spec_version",
54-
"data_content_type",
55-
"predecessor_hash",
56-
"hash",
57-
"trace_parent",
58-
"trace_state",
59-
"signature",
60-
])
61-
62-
return df
44+
return pd.DataFrame(
45+
columns=[ # pyright: ignore[reportArgumentType]
46+
"event_id",
47+
"time",
48+
"source",
49+
"subject",
50+
"type",
51+
"data",
52+
"spec_version",
53+
"data_content_type",
54+
"predecessor_hash",
55+
"hash",
56+
"trace_parent",
57+
"trace_state",
58+
"signature",
59+
]
60+
)
61+
62+
return pd.DataFrame(event_list)

0 commit comments

Comments
 (0)