In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the relevant knowledge of "what is the role of Pandas method in Python". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Pandas.cut (x, bins, right=True, labels=None, retbins=False, precision=3, include_lowest=False)
The explanation found on the Internet is too illusory, simple to understand, the main function is to classify a number (x) according to a given evaluation group (bins), determine which group the number belongs to, and return it. If you define the name of the judgment group (labels), it will be returned by name.
For example, there is a group of examinee scores, not directly given the deal, but given according to the description; then the evaluation group bins is 0-60 is a group, 60-80 is a group, 80-100 is a group, describing a labels of 0-60 points is a failure, 60-80 is a pass, 80-100 is excellent.
Then it is as follows
Import numpy as np
Import pandas as pd
Grade = [80pr 75pr 32.5100]
Bins = [0th 60th 80100]
Group_names = ['fail', 'pass', 'excellent']
Cats = pd.cut (grade, bins,labels = group_names)
Output:
[pass, fail, excellent]
Categories (3, object): [failing < passing < excellent]
The first is what we want, and the next two are additional definitions of the judging group. If we want to return to the original criteria, retbins=True is fine. The last thing to note is that the input data x must be a queue or numpy.array type
This is the end of the content of "what is the use of the Pandas method in Python". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.