Skip to content

ENH: do not write noninformative indices (like RangeIndex) by default in to_csv #56129

@bingbong-sempai

Description

@bingbong-sempai

Feature Type

  • Adding new functionality to pandas

  • Changing existing functionality in pandas

  • Removing existing functionality in pandas

Problem Description

I'm almost always setting index to False when using to_csv, which is probably true for most people.

Although setting the default to False is impossible for compatibility, would it be possible to make it so that noninformative indices (like RangeIndex) are ignored by default?

I don't imagine most people want a range as their first column in the output.

Feature Description

The default value for index in to_csv could be set to ignore_range which triggers this behaviour.

Alternative Solutions

Leave as is.

Additional Context

Similar issues #34576 and #46583

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementIO CSVread_csv, to_csvNeeds DiscussionRequires discussion from core team before further action

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions