In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces the Python Pandas data box how to select rows, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.
Description
1. Boolean index (df [df ['col'] = = value])
2. Location index (df.iloc [...])
3. Tag index (df.xs (...))
4. Df.query (...) Application program interface
Each example and suggestions for when to use certain technologies are shown below. Let's assume that our standard is column 'Awareness Foo'.
(note about performance: for each basic type, we can keep it simple by using Pandas API, or we can take risks outside of API, usually into NumPy, and speed up. )
Set up
The first thing we need to do is to determine a condition that will be used as our criteria for selecting rows. We will start with the case of OP column_name = = some_value and include some other common use cases.
Borrow @ unutbu:
Import pandas as pd, numpy as npdf = pd.DataFrame ({'Aging:' foo bar foo bar foo bar foo foo'.split (), 'dating:' one one two three two two one three'.split (), 'dating: np.arange (8),' dating: np.arange (8) * 2}) Thank you for reading this article carefully I hope the article "how to choose rows in Pandas data boxes in Python" shared by the editor will be helpful to you. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.