Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9252101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:51:40+00:00 2026-06-18T10:51:40+00:00

Im new in Pandas, and while playing with its Dataframe , i found method

  • 0

Im new in Pandas, and while playing with its Dataframe, i found method keys() which works pretty like dict.keys(). But I cannot find it in docs. What am i missing?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T10:51:42+00:00Added an answer on June 18, 2026 at 10:51 am

    You can see where this is defined in the source:

    def keys(self):
        return self.columns
    

    And, if you look at the git blame, you can see it was added as a fix for #1240: “Request: keys() method on dataFrame”. The rationale seems to be:

    While learning Pandas this kind of method is useful to move from the well-understood dict structure to the more powerful DataFrame. As a pandas novice this kind of mental mapping would be much appreciated.

    However, it’s worth noting that DataFrame supports only about half of the mapping interface. For example, there’s iteritems and keys, but no iterkeys. And there are also cases where they added similar but not-quite-the-same names, like iterkv, which is equivalent to iteritems but there specifically because the latter “gets incorrectly converted to .items() by 2to3”.

    You can go through the source and see where each of these were added and why, but there doesn’t seem to be too much rhyme or reason beyond “DataFrame is kind of like a dict, and kind of not.”

    The fact that they chose not to document most of these methods, or to document that DataFrame is kind of like a dict, I wouldn’t rely on any of this. Just use columns instead of keys(), etc.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

New to pandas python. I have a dataframe (df) with two columns of cusips.
I have two Pandas TimeSeries: x , and y , which I would like
I have a pandas dataframe like following mp me rt 0 0 1 1.987366
I kind of new to kernel building but I would like to try my
I have a pandas dataframe in which one column of text strings contains comma-separated
Suppose I have a DataFrame which has a subindex structure like the following, with
new to ruby, and rails... but not to the amp stack. my preferred method
new to python. This is probably simple but I haven't found an answer. rndStr
Im new to Python and Pandas but have a CSV file with multiple columns
New developer here,Im using the Custom Image Picker by ray wenderlich. But what I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.