If you're thinking about learning python, or you've just started learning,
You might ask yourself, "What can I do with Python?" ”
This is a tricky issue, because Python has a lot of uses.
But as time goes on,
I have found that Python can be used for a few three main things:
Web Development
Data science – including machine learning, data analysis and data visualization
Script writing
Let's take a look at it in turn.
First, web development
Python-based web frameworks such as Django and flask have recently become very popular in web development.
These web frameworks help you create server-side code (back-end code) in Python.
The code runs on your server, not on the user device and on the browser (front-end code).
If you are unfamiliar with the differences between back-end code and front-end code, see the footnotes below.
But, wait, why do I need a web framework?
That's because the web framework makes it easier to build generic back-end logic.
This includes mapping different URLs to python blocks of code, working with databases, and generating HTML files that users see in the browser.
Which Python web framework should I use?
Django and Flask are two of the most popular Python web frameworks.
If you've just started learning, you can use either of them.
What's the difference between Django and flask?
The main comparisons:
Flask provides simplicity, flexibility and fine-grained control. It is very objective (let you decide how to achieve what you want).
Django offers an all-encompassing experience: you get admin panels, database interfaces, ORM (object-relational mappling, Object-relational mappings), and directory structures for out-of-the-box applications and projects.
You should choose:
Flask, if you focus on experience and learning opportunities, or you want to have greater control over which components to choose (such as which database you want to use and how to interact with them).
Django, if you focus on the final product. Especially if you're doing a simple application (like a news website, an e-shop, or a blog) and want to have a straightforward approach.
In other words, if you are a beginner, flask may be a better choice because fewer components are used.
If you want more customization, then flask is a better choice.
And, according to my data engineer friend's opinion,
Flask is better suited to creating something called Rest API because it's more flexible than Django.
On the other hand
If you want to build something simple,
Django will allow you to reach your goals faster.
OK, let's talk about the next!
II. Data science-including machine learning, data analysis and data visualization
First, let's review what machine learning is.
I think the best way to explain what is machine learning is to cite an example.
Suppose you want to develop a program that automatically detects the contents of a picture.
So, for this picture below (picture 1), you want your program to recognize that this is a dog.
For the following picture (Picture 2), you want your program to recognize that it is a table.
You might say I can do it in a few lines of code. For example, if you have a lot of light-brown pixels on the picture, then we can say that it's a dog.
Or, you can find a way to detect edges in your photos. Then, you might say, if there's a lot of straight edges, then that's a table.
However, this method soon got into trouble. What if there's a white dog with no brown hairs on the picture? What if the picture shows just the round part of the table?
It's my turn to machine learning.
For example, you have a machine-learning algorithm that provides 1000 dog photos and 1000 table photos. Well, it will learn to distinguish between dogs and tables. When you give a new picture of a dog or table, it will be able to identify the dog or table.
I think it's a little bit like a baby learning something new. How does a baby know that one thing looks like a dog, while something else looks like a table? It may have been learned from a lot of examples.
You may not be able to tell a baby clearly: "If something is furry and has light brown hair, it may be a dog." ”
You may just say, "That's a dog." This is a dog, too. This is the table. That's the table, too. ”
Machine learning algorithms work in roughly the same way.
You can apply the same idea to:
Referral systems (like YouTube, Amazon, and Netflix)
facial recognition
Sound recognition
Popular machine learning Algorithms you may have heard of include:
Neural network
Deep learning
Support Vector Machine
Random Forest
You can use any of the above algorithms to solve the picture labeling problem I just explained.
Iii. using Python for machine learning
There are some popular Python machine learning libraries and frameworks, the two most popular of which are Scikit-learn and TensorFlow.
Scikit-learn comes with some of the more popular built-in machine learning algorithms. I just mentioned a few of them.
TensorFlow is more like a low-level library that allows you to build custom machine learning algorithms.
If you are just starting a machine learning project, then I suggest you use Scikit-learn first. If you start to experience efficiency issues, then I suggest using TensorFlow.
Note that you need basic knowledge of calculus and linear algebra to understand some of these lessons.
Iv. data analysis and data visualization?
To help you understand, I'm here to give you a simple example. Suppose you work for a company that sells products online.
So, as a data analyst, you might draw a similar bar chart.
From this picture, we can see that in a particular Sunday, for a certain product, men bought more than 400, while women bought about 350.
As a data analyst, you may be able to make several possible explanations for the differences.
One obvious possible explanation is that the product is more prevalent among men than in women. Another possible explanation is that the sample size is too small and the difference is occasionally generated. Another possible explanation is that in the Sunday, for some reason, men were more inclined to buy the product than women.
In order to understand which explanation is correct, you might draw another diagram, as shown in:
We don't just show the Sunday data, but the whole week. As you can see, from this picture, we see that this difference is consistent on different days.
From this simple analysis, you may have come to the conclusion that one of the most convincing explanations for this discrepancy is that the product is more popular with men than women.
On the other hand, what if you see a diagram like the one shown below?
Line Figure 2-also generated by Python
So, how do you explain the differences that appear in the Sunday?
You might say that, for some reason, men are more likely to buy the product in Sunday. Or maybe it was just a coincidence that men bought more of the product in Sunday.
Well, this is a simplified example of what data analysis looks like in the real world.
I did data analysis when I was working with Google and Microsoft, which is very similar to this example, just a little bit more complicated. In fact, when I was working for Google, I used Python to do this kind of analysis, and I used JavaScript when I was at Microsoft.
When I was working in these two companies, I used SQL to extract data from the database. Then I'll use Python and matplotlib (while working at Google) or Javascrip and d3.js (while working at Microsoft) to visualize and analyze data.
V. Data analysis/visualization with Python
One of the most popular data visualization libraries is matplotlib.
When you start learning, it's a good library because:
It's easy to get started
Some other libraries, such as Seaborn, are based on it. Therefore, learning matplotlib can help you later learn other libraries.
Six, choose Python 3 or Python 2?
I would recommend Python 3 because it is more modern and it is now more popular.
Footnote: A description of the backend code and the front-end code (in case you are unfamiliar with these terms).
Let's say you want to do something like Instagram.
Then, you need to create front-end code for each device you want to support:
Swift for iOS devices
Java for Android devices
JavaScript for Web browsers
Each set of code will run on the corresponding type of device/browser. This set of code determines how the layout of the app looks, what the button looks like when clicked, and so on.
However, you still need the ability to store user information and photos. In addition to storing this information in the user's device vendor, you will want to store this information on the server so that each user's followers will be able to see the user's photos.
This is where back-end code/server-side code comes in. You need to write back-end code to do the following:
Keep track of who's Watching who
Compress photos so you don't occupy too much storage space
Recommend photos and new accounts to each user in the discovery feature
Well, that's the difference between the back-end code and the previous code.
By the way, Python is not the only good choice for writing back-end/server-side code. There are many other popular options, including node. js, which are JavaScript-based.
If you have any ideas or comments, welcome to buckle: 1192893289
Python so fire, what can be used to do? Let's say the main application of Python3