Skip to content

add option for to_pandas() to not index primary keys #1745

Description

@Dev-Lan

When I call resource.to_pandas() on a resource that has a primaryKey defined that key is used as an index for the dataframe. This is a reasonable default behavior, but took me some time to realize/debug.

Possible Solutions

  1. Add an option for the to_pandas function of index=false, (with a default of true) which follows a similar pattern to pandas to_csv function.
  2. Add additional documentation on the to_pandas function. The only thing I could find online for this was here: https://framework.frictionlessdata.io/docs/formats/pandas.html
    Adding additional documentation here that describes how primaryKey fields are used to index the dataframe would've cleared this up for me.

Current Workaround
Now that I know that to_pandas works this way I can call df.reset_index() [docs] to turn those index columns into regular columns, which is what I want in my situation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions