{"record":{"id":"32200bd03eed25fd","repo":"nautechsystems/nautilus_trader","slug":"pandas-is-required-for-report-generation-install","errorCode":null,"errorMessage":"pandas is required for report generation; install it with `pip install pandas`","messagePattern":"pandas is required for report generation; install it with `pip install pandas`","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"python/nautilus_trader/analysis/reporter.py","lineNumber":40,"sourceCode":"\nfrom __future__ import annotations\n\nfrom typing import TYPE_CHECKING\n\nfrom nautilus_trader.model import OrderFilled\n\n\nif TYPE_CHECKING:\n    from typing import Any\n\n    import pandas as pd\n\n\ndef _require_pandas() -> None:\n    try:\n        import pandas as pd  # noqa: F401 (presence check)\n    except ImportError as e:\n        raise ImportError(\n            \"pandas is required for report generation; install it with `pip install pandas`\",\n        ) from e\n\n\ndef _ns_to_dt(ts: int) -> pd.Timestamp:\n    import pandas as pd\n\n    return pd.Timestamp(ts, tz=\"UTC\")\n\n\nclass ReportProvider:\n    \"\"\"\n    Provides various portfolio analysis reports.\n    \"\"\"\n\n    @staticmethod\n    def generate_orders_report(orders: list) -> pd.DataFrame:\n        \"\"\"","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/python/nautilus_trader/analysis/reporter.py#L22-L58","documentation":"In apply_stream_conversion_transforms, when use_ts_event_for_ts_init is true the function overwrites ts_init with ts_event values. It first looks up the ts_event column via schema.index_of(\"ts_event\"); arrow's index_of returns an error when the column is absent, and this anyhow error replaces it. Without ts_event the ts_event-for-ts_init substitution cannot be performed.","triggerScenarios":"Invoking the stream conversion with use_ts_event_for_ts_init = true (e.g. converting old stream data that stored ts_event semantics in ts_init) on batches whose schema has no ts_event column.","commonSituations":"Converting legacy Feather/stream recordings from older NautilusTrader versions whose data writers did not emit a ts_event column; custom data types that only carry ts_init; schema drift between the recorded stream and the current writer.","solutions":["Verify the source batches contain a ts_event column (batch.schema().column_with_name(\"ts_event\")) before requesting the ts_event-for-ts_init conversion.","If the data genuinely lacks ts_event, run the conversion without use_ts_event_for_ts_init (keep existing ts_init values instead of substituting).","Re-export or rewrite the source data with a current writer so both ts_event and ts_init columns exist.","Check for schema drift: confirm the batches were decoded with the same encoding/writer version that recorded them."],"exampleFix":"// before\nlet opts = StreamConversionOptions { use_ts_event_for_ts_init: true, .. };\n\n// after: check schema first\nassert!(batch.schema().column_with_name(\"ts_event\").is_some(),\n    \"stream data has no ts_event column; disable use_ts_event_for_ts_init\");","handlingStrategy":"validation","validationCode":"assert!(batch.schema().column_with_name(\"ts_event\").is_some(),\n    \"stream batch lacks ts_event; do not enable use_ts_event_for_ts_init\");","typeGuard":"fn has_ts_event(batch: &RecordBatch) -> bool {\n    batch.schema().column_with_name(\"ts_event\").is_some()\n}","tryCatchPattern":"match apply_transforms(batches, use_ts_event_for_ts_init) {\n    Err(e) if e.to_string().contains(\"ts_event column not found\") => {\n        // fall back to keeping existing ts_init\n    }\n    r => r,\n}","preventionTips":["Check schema.column_with_name before enabling the ts_event-for-ts_init option","Re-record legacy streams with the current writer so both timestamp columns exist","Keep a schema registry per stream recording version"],"tags":["arrow","schema","missing-column","data-conversion"],"backgroundTag":"schema-validation-failed","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}