In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article is about how to parse the value of None in Python data. The editor thinks it is very practical, so I share it with you. I hope you can get something after reading this article.
As long as you deal with data, it is impossible not to face a headache-null values in the data set. Null value processing is one of the important contents of data cleaning in data preprocessing.
The Python data analysis package Pandas provides some convenient functions that can help us quickly deal with and resolve null values as expected.
The first way to deal with null values: quickly confirm whether there are null values in the dataset. There are two functions, isnull and notnull, that can help us quickly locate whether each element in the dataset is null.
When it comes to null values, it is defined in NumPy as None in np.nan,Python, so pay attention to this expression. There is a hole in this, that is, a column or row of Pandas object. Directly use np.nan and None to determine whether the element is empty or not, and find that all returns are False. Note: this is not advisable!
The second move, assuming that there is a null value, you can use the fillna function in Pandas to fill the null value. Fillna has a key parameter: method. When setting method to pad, how to fill it? Propagates from the previous valid data to the next valid data row. In addition, there is a keyword limit. Exe that limits the number of consecutive null rows.
Third, null data is detected, but you don't want to do any padding, but you just want to discard the null data. Pandas provides the dropna function to do this. There are two key parameters: axis and how. For example, the combination: axis = 0PowerHow =\ 'any\', which means that a row will be discarded as long as an element is null.
The above is how to parse the None value in Python data. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, 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.
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.