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/03 Report--
What is pandas? You may see a variety of explanations, but ta is actually a data analysis package. There's nothing to explain.
There are three common data structures in pandas: Series (one-dimensional array, also called sequence), DataFrame (two-dimensional table, similar to excel multi-row and multi-column), and Panel (three-dimensional array).
So what is the data structure? Is a collection of data types of one or more specific relationships that exist with each other.
Well, the concept is so simple, I believe that friends with python foundation should be easy to understand, if you do not. MMM... There is no such thing, right?
Today, let's first introduce the use of Series, the direct upload code, which has comments.
From pandas import Series# defines a sequence "" A sequence can hold different data types, the index index can also be ignored, can be accessed through the subscript (starting from 0) run may report an error: ImportError: C extension: No module named 'pandas._libs.tslib' not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext-inplace-force' to build the C extensions first. Solution: first pip3 uninstall pandas in pip3 install-- user pandas "" x=Series (['first','second','thrid']) print (' value by subscript', x [1]) print ('value by index', x ['second']) # x [3] can not cross the boundary access will report error # x.append (666) # cannot append a single element n=Series ([666]) Index= ['fourth']) # can append a sequence print (' after adding sequence', x.append (n)) if 1 in x.values: print ('good') # slice print (' slice:', x [1:3]) # location acquisition Commonly used for random sampling print (x [[0Power2]]) # delete # x.drop (0) # according to the subscript # x.drop ('first') # find the index name print (x.index [2]) according to the index # according to the index # delete by value Return the new sequence # x [2quotix.values # modified value x.index [True==x.values] # convert the dictionary to series#Series (dictionary format) # sort the index y=Series ([2pje 3pl 1pl 5], index= ['axiaoyunzhuo]) print (y.sort_index (ascending=True)) # ascending controls ascending or descending
OS: writing code is tiring, but it's really fun. Why don't you try it?
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.