In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail what the third-party library in python is, and the content of the article is of high quality, so the editor will share it with you for reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.
As an open source computer language, python has many third-party libraries, so what is the third-party library?
To take a simple example, now the most popular big data analysis, the data visualization processing, so what to do visualization processing? If you think about it, if you write an algorithm to implement, then is there a model, which is specifically used to solve the problem of visual analysis, when we need to use it? just change some of the parameters that need to be entered by ourselves and it can run on its own. The answer is: yes, at this time we need to use one of the three artifacts of our python data analysis-numpy, I want to use this library, do I want to tell python that we need to use this library? So how do you tell it? It's simple, just type import numpy in the editor, for example, we need to generate a matrix.
We need to use the numpy library, and then we tell python that I'm going to use numpy, so we type import numpy, so what are we going to do after typing numpy? Our aim was to produce a matrix and assign it to a, so we went on to type a=numpy.array ([[1rem 5je 6], [5m 8je 2]])
The array after numpy can generate matrices. We printed out the following matrix.
[[1 5 6]
[5 8 2]]
So if there is no numpy, do you know how to represent this matrix? These third-party libraries bring us these conveniences.
If we want to generate other matrices, we all have to write numpy.array (the matrix we want to generate), this numpy letter is relatively small, if too many letters will waste a lot of our time, so when we import, we'd better give it a new name, generally called np, and then generate the matrix.
Is it a lot more concise? All matrix operations can be done with numpy. It includes finding the inverse of matrix, solving multivariate first order equation, solving linear programming and so on.
If we want to express the data graphically, we need to use matplotlib as a library. From February 15 to February 20, the cumulative number of infections of COVID-19 somewhere is 400, 500, 600, 600, 700, 800, and 1000. We can visualize this data through pyplot in matplotlib to generate the following diagram.
Different functions sometimes require different third-party libraries to operate, this third-party library is not very much like a software, you just enter your parameters, and it will automatically solve your problem for you.
But since numpy, a third-party library, was not installed in the python we downloaded from the official website, python reported me an error when I imported numpy
It tells me that No module named 'numpy', means to tell me that there is no such module in python, so what should we do with it? The answer is to install it yourself. I read a lot of tutorials on the Internet, install win+R, enter in the pop-up window, python into the window, enter pip install numpy, but I do not know why, I typed this result.
It shows Invalid syntax, syntax error meaning, in this case, you can go to the numpy official website to download numpy wheel file, and then enter the folder directory for installation, but this is too troublesome, because the functions of these third-party libraries are different, such as drawing requires matplotlib, crawlers need requests library. We waste a lot of time if we do this every time. But if we installed anaconda, it would contain these libraries.
About what the third-party library in python is shared here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
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.