In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the main functions of Pandas1.0, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.
Note: Pandas 1.0.0rc was released on January 9th and the previous version was 0.25.
The first new major release of Pandas includes many important features: a more complete automatic summarization of data boxes, a more comprehensive output format, new data types, and documentation sites.
Complete release notes can be found on the new documentation site, but Xiao Xin believes that a low-tech overview will also help.
Users can use pip to upgrade Pandas to use its new version. At the time of this writing, Pandas1.0 is still a candidate, which means that you need to specify its version explicitly to install Pandas1.0.
Pip install-upgradepandas==1.0.0rc0
Of course, updates can break some code, because this is a major release, so be careful! Python 2 is no longer supported in this version of Pandas. Running Pandas 1.0 + requires at least Python 3.6 versions, so be sure to use the appropriate versions of pip and python.
$pip-- version pip 19.3.1 from / usr/local/lib/python3.7/site-packages/pip (python3.7) $python--version Python 3.7.5
Users can confirm that everything is fine and that Pandas is using the correct version.
> > import pandas as pd > pd.__version__ 1.0.0rc0
Use DataFrame.info for better automatic summarization
The author's favorite new function is the optimized DataFrame.info method. Now, it uses a more readable format, making the data exploration process easier.
> df = pd.DataFrame ({...: 'Achievement: [1pje 2pi 3],...:' baked: ["goodbye", "cruel", "world"],...: 'clocked: [False, True, False].:}) > > df.info () RangeIndex: 3 entries 0 to 2 Data columns (total 3 columns): # Column Non-Null Count Dtype-0 A 3 non-null int64 1 B 3 non-null object 2 C 3 non-null object dtypes: int64 (1), object (2) memory usage: 200.0 + bytes
Output format of Markdown table
Secondly, the author's favorite function is to export data frames to the Markdown table using the new DataFrame.to_markdown method.
> df.to_markdown () | | A | B | C |--: |-- |:-- |:-| 0 | 1 | goodbye | False | | 1 | 2 | cruel | True | 2 | 3 | world | False |
This makes it easier to display tables in places such as Medium through github gists.
New data types for booleans and strings
Pandas1.0 also introduces experimental data types for booleans and strings.
Because these changes are experimental, the API of the data type may change slightly, so you should use it with caution. But Pandas recommends that these data types be used in a reasonable way, and future releases will improve the performance of type-specific operations such as regex matching.
By default, Pandas does not automatically cast data to these types. However, if you explicitly instruct Pandas, you can still use them.
> B = pd.Series (["goodbye", "cruel", "world"], dtype= "string") > C = pd.Series ([False, True, False], dtype= "bool") > df.B = B, df.C = C > df.info () RangeIndex: 3 entries 0 to 2 Data columns (total 3 columns): # Column Non-Null Count Dtype-0 A 3 non-null int64 1 B 3 non-null string 2 C 3 non-null bool dtypes: int64 (1), object (1), string (1) memory usage: 200.0 + bytes
Notice how the Dtype column now reflects the new types of string and bool.
The most practical advantage of the new string dtype is that you can select the string column from DataFrame. This makes it faster to analyze only the text components of the dataset.
Df.select_dtypes ("string")
Previously, string type columns could only be selected by explicitly using their names.
Thank you for reading this article carefully. I hope the article "what are the main functions of Pandas1.0" shared by the editor will be helpful to you. At the same time, I also hope 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.
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.