Skip to content

Conversation

Copy link

Copilot AI commented Oct 29, 2025

FlightDataExporter.export_data() generates CSV headers with spaces after commas (e.g., # Time (s), Vz (m/s)), causing pandas to parse column names with leading spaces (' Vz (m/s)' instead of 'Vz (m/s)').

Changes

  • flight_data_exporter.py:159: Remove space after comma in header concatenation

    # Before
    exported_header += f", {variable_function.__outputs__[0]}"
    
    # After  
    exported_header += f",{variable_function.__outputs__[0]}"
  • test_flight_data_exporter.py: Add test validating header format and pandas column accessibility

Impact

Before:

df = pd.read_csv("flight_data.csv")
df[' Vz (m/s)']  # Leading space required

After:

df = pd.read_csv("flight_data.csv")
df['Vz (m/s)']  # No leading space

Aligns general path behavior with fast path (lines 104-115), which already uses comma-only formatting.

Fixes #864

Original prompt

solve issue #864


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Fix issue 864 Fix CSV column header spacing in FlightDataExporter Oct 29, 2025
Copilot AI requested a review from Gui-FernandesBR October 29, 2025 02:41
Copilot finished work on behalf of Gui-FernandesBR October 29, 2025 02:41
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes CSV export headers to remove leading spaces after commas, making column names more accessible when reading with pandas (addresses Issue #864).

  • Removed space after comma in CSV header generation for the general export path
  • Added comprehensive test to validate CSV column headers have no leading spaces

Reviewed Changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.

File Description
rocketpy/simulation/flight_data_exporter.py Removed space after comma in header string concatenation for custom variable exports
tests/unit/test_flight_data_exporter.py Added test to verify CSV headers don't contain leading spaces and are pandas-compatible

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Oct 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.28%. Comparing base (9cf3dd4) to head (b4aef19).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #865   +/-   ##
========================================
  Coverage    80.27%   80.28%           
========================================
  Files          104      104           
  Lines        12769    12769           
========================================
+ Hits         10250    10251    +1     
+ Misses        2519     2518    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI and others added 3 commits November 2, 2025 16:10
Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>
Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>
Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>
@Gui-FernandesBR Gui-FernandesBR marked this pull request as ready for review November 2, 2025 19:11
@Gui-FernandesBR Gui-FernandesBR requested a review from a team as a code owner November 2, 2025 19:11
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 1 out of 2 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

2 participants