Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Case Analysis of python data

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

In this article, the editor introduces in detail the "case analysis of python data", with detailed contents, clear steps and proper handling of details. I hope that this "case analysis of python data" article can help you solve your doubts.

data

Assuming that our data is like this, with no anomalies and no missing values, let's practice exploratory data analysis with Pandas through a few questions.

Yearnamesalarytitle2001aa1500first2002bb4300first2003cc7000second2001dd5000third question 1: what is the maximum salary?

We read the data and named it df.

Import pandas as pd

Df ['salary'] .max ()

Similarly, lowest (min), average (mean).

Question2: what is bb's salary?

Suddenly thought of SQL, is it an one-sentence thing, select...from...where... Of course, our pandas is also a matter of one sentence:

Df [df ['name'] =' bb'] ['salary'] question 3: who is the person with the highest income?

Then we will locate the line with the highest income.

Df [df ['salary'] = = df [' salary'] .max ()]

# or

Df.loc [df ['salary'] .idxmax ()] question 4: average annual income for all employees?

Is it natural to think of grouping, group by?

Df.groupby ('year'). Mean () [' salary'] question 5: how many job titles are there?

I use the nunique () function here. I had a small partner who communicated with me and found that I didn't understand the difference between the nunique () function and the unique () function.

Df ['title'] .nunique () has read this article "python data instance Analysis". If you want to master the knowledge points of this article, you still need to practice and use it. If you want to know more about related articles, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

  • Mybatis applicationContext.xml configuration method

    # what to do in applicationContext.xml Spring integrate Mybatis configuration

    © 2024 shulou.com SLNews company. All rights reserved.

    12
    Report