Python的用途是什么? Python编程语言有10多种编码用途。

👋欢迎 (👋 Welcome)

Hi! Please take a moment to think about this question:

嗨! 请花一点时间考虑这个问题:

How is Python applied in real-world scenarios?

Python如何在实际场景中应用?

If you are learning Python and you want to know the answer, then this article is for you.

如果您正在学习Python,并且想知道答案,那么本文适合您。

Having a clear idea of the applications and vast potential of this programming language will give you the motivation that you will need throughout your journey.

对应用程序有清晰的认识,并希望这种编程语言具有巨大的潜力,这将带给您整个旅程中需要的动力。

Let's begin! 🔅

让我们开始! 🔅

真实场景中的Python (Python in Real-World Scenarios)

Python is used in virtually every industry and scientific field that you can imagine, including:

您几乎可以想象到的每个行业和科学领域都使用Python,包括:

  • Data Science.

    数据科学。
  • Machine Learning.

    机器学习。
  • Web Development.

    Web开发。
  • Computer Science Education.

    计算机科学教育。
  • Computer Vision and Image Processing.

    计算机视觉和图像处理。
  • Game Development.

    游戏开发。
  • Medicine and Pharmacology.

    医学和药理学。
  • Biology and Bioinformatics.

    生物学和生物信息学。
  • Neuroscience and Psychology.

    神经科学与心理学。
  • Astronomy.

    天文学。
  • Other areas such as robotics, autonomous vehicles, business, meteorology, and graphical user interface (GUI) development.

    其他领域,例如机器人技术,自动驾驶汽车,商业,气象学和图形用户界面(GUI)开发。

This article covers a wide range of applications of this programming language in these industries with examples, use cases, and Python libraries. Let's start with the applications of Python in data science.

本文通过示例,用例和Python库涵盖了该编程语言在这些行业中的广泛应用。 让我们从Python在数据科学中的应用开始。

🔹数据科学:分析和可视化 (🔹 Data Science: Analysis and Visualization)

Perhaps one of the most popular applications of Python is data science. The power of the Python libraries developed for data analysis and visualization is amazing. Let's see why.

数据科学是Python最流行的应用之一。 开发用于数据分析和可视化的Python库的功能是惊人的。 让我们看看为什么。

数据科学应用 (Data Science Applications)

With a Python data visualization library, you can create a wide variety of plots and visual representations, such as:

借助Python数据可视化库,您可以创建各种各样的图形和视觉表示,例如:

  • Lines, Bars, and Markers.

    线,条和标记。
  • Images, contours and fields.

    图像,轮廓和字段。
  • Subplots, axes and figures.

    子图,轴和图形。
  • Statistics (Box Plots, Bar Charts, and Histograms).

    统计信息(箱形图,条形图和直方图)。
  • Pie and polar charts.

    饼图和极坐标图。
  • 3D Plots.

    3D图。
  • and more!

    和更多!

You can add text, labels, annotations, color, shapes, collections, animations, and interactivity to your plots depending on the package or library that you choose to work with.

您可以根据选择使用的程序包或库,将文本,标签,注释,颜色,形状,集合,动画和交互性添加到绘图中。

💡 Tip: You can see some examples of data visualizations generated with Python in the image above.

提示:您可以在上图中看到一些使用Python生成的数据可视化示例。

库和包 (Libraries and Packages)

Let's see some of the most popular packages and libraries to work with Python in data science:

让我们来看一些在数据科学中可以使用Python的最受欢迎的软件包和库:

用于数据分析的Python (Python for Data Analysis )

  • NumPy: this package is described as "the fundamental package for scientific computing with Python". According to the official website of this package, "nearly every scientist working in Python draws on the power of NumPy."

    NumPy :该软件包被描述为“使用Python进行科学计算的基本软件包”。 根据该软件包的官方网站,“几乎所有从事Python工作的科学家都利用NumPy的力量。”

  • Pandas: is "a fast, powerful, flexible and easy to use open source data analysis and manipulation tool."

    Pandas :是“一种快速,强大,灵活且易于使用的开源数据分析和处理工具”。

用于数据可视化的Python (Python for Data Visualization)

  • Matplotlib: is "a comprehensive library for creating static, animated, and interactive visualizations in Python." If you are curious about what you can do with this library, check out the example gallery.

    Matplotlib :是“用于在Python中创建静态,动画和交互式可视化的综合库。” 如果您对使用此库可以做什么感到好奇,请查看示例库

  • Seaborn: is "a Python data visualization library based on matplotlib." If you are curious about what you can do with this library, check out the example gallery.

    Seaborn :是“基于matplotlib的Python数据可视化库”。 如果您对使用此库可以做什么感到好奇,请查看示例库

  • ggplot2: is "a system for declaratively creating graphics, based on The Grammar of Graphics". According to its official website: "you provide the data, tell ggplot2 how to map variables to aesthetics, what graphical primitives to use, and it takes care of the details."

    ggplot2 :是“基于图形语法的声明式创建图形的系统”。 根据其官方网站的说法:“您提供数据,告诉ggplot2如何将变量映射到美观,使用哪些图形基元,以及如何处理细节。”

  • Bokeh: is "an interactive visualization library for modern web browsers".

    Bokeh :是“用于现代Web浏览器的交互式可视化库”。

  • Pandas: this library has many tools for data visualization.

    熊猫 该库具有许多用于数据可视化的工具。

学习资源 (Learning Resources)

If you want to learn data analysis and visualization using Python, Jupyter Notebooks, Numpy, Pandas, CSV files, data frames, and more, you can start your journey with freeCodeCamp's free Data Analysis with Python Certification:

如果您想使用Python,Jupyter Notebooks,Numpy,Pandas,CSV文件,数据框等来学习数据分析和可视化,则可以使用freeCodeCamp的免费Python数据分析认证开始您的旅程:

During the certification, you work on and complete these projects:

在认证期间,您将从事并完成以下项目:

  • Mean-Variance-Standard Deviation Calculator.

    均方差标准偏差计算器。
  • Demographic Data Analyzer.

    人口统计数据分析器。
  • Medical Data Visualizer.

    医疗数据可视化器。
  • Page View Time Series Visualizer.

    页面视图时间序列可视化工具。
  • Sea Level Predictor.

    海平面预测器。

freeCodeCamp's YouTube channel also has these great free tutorials to get you started:

freeCodeCamp的YouTube频道也提供了这些免费的入门教程,帮助您入门:

In addition, these are helpful resources if you want to learn how to work with these libraries:

此外,如果您想学习如何使用这些库,这些是有用的资源:

🔸机器学习 (🔸 Machine Learning)

Python is an essential tool for every developer who wants to enter the fascinating area of Machine Learning. Let's see a brief introduction to Machine Learning.

对于每个想要进入机器学习引人入胜的领域的开发人员来说,Python是必不可少的工具。 让我们看一下机器学习的简要介绍。

什么是机器学习? (What is Machine Learning?)

Machine Learning is an area of Computer Science that creates systems that are able to learn on their own.

机器学习是计算机科学的一个领域,它创建能够自行学习的系统。

This type of system uses algorithms that are continuously improved based on input data that helps the system "learn". It learns how to respond autonomously to new scenarios by generating an appropriate output in new scenarios based on previous knowledge.

这种类型的系统使用的算法会根据有助于系统“学习”的输入数据进行不断改进。 它学习如何通过基于先前的知识在新方案中生成适当的输出来自动响应新方案。

One of the most amazing things about these systems is that they are continually refined.

这些系统最令人惊奇的事情之一就是它们不断地完善。

They are not like the programs that we typically write in a Python script where we specify every possible action that the program can take. In Machine Learning, the system is trained to "think" and make decisions based on previous knowledge.

它们与我们通常在Python脚本中编写的程序不同,在Python脚本中,我们指定了程序可以执行的所有可能操作。 在机器学习中,训练该系统以“思考”并根据先前的知识做出决策。

This is why we say that machines "learn" from the data.

这就是为什么我们说机器从数据中“学习”。

💡 Tip: This is an interesting talk by Google: Machine Learning Zero to Hero (Google I/O'19).

💡提示:这是Google的有趣演讲: 机器学习对英雄零(Google I / O'19)

神经网络:机器学习的基础 (Neural Networks: The Building-Blocks of Machine Learning)

Neural networks are the processing units of the system. They try to simulate a real network of neurons of the brain. They virtual "neurons" receive input, learn how to process that input, and generate an output based on their previous knowledge.

神经网络是系统的处理单元。 他们试图模拟大脑神经元的真实网络。 他们的虚拟“神经元”接收输入,学习如何处理该输入,并根据其先前的知识生成输出。

This is very similar to what out brain does every single moment of every single day.

这与大脑每一天每一刻所做的事情非常相似。

Thanks to neural networks, a Machine Learning algorithm can learn how to predict the expected output from a given input based on previous knowledge.

得益于神经网络,机器学习算法可以根据先前的知识学习如何根据给定的输入预测预期的输出。

For example, when you see recommended videos on YouTube, those recommendations were generated by neural networks that predict what videos you might like to watch based on your previous patterns. Amazing, right?

例如,当您在YouTube上看到推荐的视频时,这些推荐是由神经网络生成的,这些神经网络会根据以前的模式来预测您可能希望观看的视频。 太好了吧?

💡 Tip: This is an interesting article by Google if you would like to read more about this YouTube example.

💡提示:如果您想阅读有关此YouTube示例的更多信息,这是Google的一篇有趣的文章

Python和机器学习 (Python and Machine Learning)

I'm sure you must be asking: what is the role of Python in this area? It is one of the most popular and powerful tools used to program this type of system.

我确定您一定要问:Python在这一领域的作用是什么? 它是用于对这种类型的系统进行编程的最流行和功能最强大的工具之一。

One of the most popular libraries used by developers around the world to work with Python applied to Machine Learning is TensorFlow. It's a free open-source library developed by the Google Brain Team. This library is used for research and production at Google.

TensorFlow是全世界开发人员在将Python应用于机器学习时使用的最受欢迎的库之一。 这是Google Brain团队开发的免费开源库。 该库用于Google的研究和生产。

According to Jeff Dean, the lead of Google's Artificial Intelligence division:

Google人工智能部门负责人Jeff Dean表示:

Today it is used heavily in our speech recognition systems, in a new Google Photos product, Gmail, and Google Search. (source)

如今,它已广泛用于我们的语音识别系统,新的Google相册产品,Gmail和Google搜索中。 ( 来源 )

The best part is that developers all over the world can use this library to tackle real-world problems.

最好的部分是,全世界的开发人员都可以使用该库来解决实际问题。

💡 Tip: This is a great video about TensorFlow made by Google.

💡提示:这是Google制作的有关TensorFlow精彩视频

These are two other popular Python libraries used for Machine Learning:

这是用于机器学习的另外两个流行的Python库:

  • Keras – an open-source neural-network library written in Python.

    Keras –用Python编写的开源神经网络库。

  • PyTorch – an open-source Machine Learning library used for developing and training neural networks.

    PyTorch –一个开源的机器学习库,用于开发和训练神经网络。

Python中的机器学习项目 (Machine Learning Projects in Python)

The potential of Machine Learning is really endless. It can be applied to virtually any area and context that you can think of. If the task requires learning from patterns and predicting output, then a Machine Learning model can definitely help.

机器学习的潜力确实是无限的。 它几乎可以应用于您能想到的任何领域和环境。 如果任务需要学习模式并预测输出,那么机器学习模型绝对可以提供帮助。

For example, to give you an idea of the type of projects that you can create, freeCodeCamp's curriculum includes a free Machine Learning with Python Certification:

例如,为了让您大致了解可以创建的项目类型, freeCodeCamp的课程包括免费的具有Python认证的机器学习

During the certification, you work on and complete these projects:

在认证期间,您将从事并完成以下项目:

  • Rock Paper Scissors.

    剪刀石头布。
  • Cat and Dog Image Classifier.

    猫和狗图像分类器。
  • Book recommendation engine using K-Nearest Neighbors.

    使用K最近邻居的图书推荐引擎。
  • Linear Regression health costs calculator.

    线性回归健康费用计算器。
  • Neural Network SMS classifier.

    神经网络SMS分类器。

实际应用的更多示例 (More Examples of Real-World Applications)

You can find more examples of the applications of Machine Learning in Kaggle, an "online community of data scientists and machine learning practitioners" owned by Google.

您可以在Google拥有的“数据科学家和机器学习从业人员在线社区” Kaggle中找到有关机器学习应用的更多示例。

In this platform, you can practice your Python and Machine Learning skills by working on projects and participating in competitions.

在这个平台上,您可以通过参与项目和参加比赛来练习Python和机器学习技能。

To give you an idea of the type of projects that you can tackle with Machine Learning, previous competitions in Kaggle include:

为了让您了解可以使用机器学习解决的项目类型,以前在Kaggle中进行的比赛包括:

  • Predicting lung function decline.

    预测肺功能下降。
  • Predicting survival on the Titanic.

    预测泰坦尼克号的生存时间。
  • Building tools for bird population monitoring.

    用于监视鸟类数量的构建工具。
  • Labeling famous landmarks.

    标记著名的地标。
  • Forecasting COVID-19 spread.

    预测COVID-19传播。
  • Estimating the unit sales of Walmart retail goods.

    估计沃尔玛零售商品的单位销售额。
  • Identifying videos with face or sound manipulations.

    通过面部或声音操作识别视频。
  • Predicting wait times at major city intersections.

    预测主要城市十字路口的等待时间。
  • Detecting fraud from customer transactions.

    从客户交易中检测欺诈。
  • Predicting a movie's worldwide box office revenue.

    预测电影的全球票房收入。
  • Predicting pet adoption.

    预测收养宠物。
  • Identifying risk when pilots are distracted, sleepy, or in other dangerous cognitive states.

    识别飞行员分心,困倦或处于其他危险认知状态时的风险。

As you can see, just in this short list of projects, the applications range from medicine to business, from biology to risk detection, and from fraud detection to image processing. The possibilities are truly endless when you tackle real-world problems using Machine Learning.

如您所见,仅在这个简短的项目列表中,应用程序就涵盖了从医学到商业,从生物学到风险检测以及从欺诈检测到图像处理的各种应用。 当您使用机器学习解决实际问题时,可能性是无限的。

学习资源 (Learning Resources)

freeCodeCamp's YouTube channel has these helpful tutorials to get you started with Machine Learning in Python:

freeCodeCamp的YouTube频道提供了以下有用的教程,可帮助您开始使用Python进行机器学习:

🔹网站开发 (🔹 Web Development)

Python is used in the field of web development to build the back-end of web applications. Let's start this section by talking a little bit about what the back-end is and how it helps us to create web applications.

Python在Web开发领域中用于构建Web应用程序的后端。 让我们从本节开始,先讨论一下后端是什么以及它如何帮助我们创建Web应用程序。

用于后端Web开发的Python (Python for Back-End Web Development)

In a web application, all the code used to interact with the user and create what the user sees is called the front-end part of the application.

在Web应用程序中,用于与用户交互并创建用户所见内容的所有代码都称为应用程序的前端部分。

Python is used to code the behind-the-scenes functionality of the application, the part that powers all the functionality of the application but that you don't see directly on screen.

Python用于对应用程序的幕后功能进行编码,该部分可为应用程序的所有功能提供支持,但您不能直接在屏幕上看到它。

It handles the server-side of the application, interacting with all the necessary databases when the user requests data. It returns the requested data to the user to make the application run as expected.

它处理应用程序的服务器端,并在用户请求数据时与所有必需的数据库进行交互。 它将请求的数据返回给用户,以使应用程序按预期运行。

💡 Tip: Full-Stack Web Development involves both the front-end and back-end of a web application to make it presentable to the user while working with databases.

提示:全栈Web开发涉及Web应用程序的前端和后端,以使其在使用数据库时可呈现给用户。

Web框架 (Web Frameworks)

These are some popular Python web frameworks:

这些是一些流行的Python Web框架:

  • Django: a "high-level Python Web framework that encourages rapid development and clean, pragmatic design."

    Django :“鼓励快速开发和简洁实用的设计的高级Python Web框架”。

  • Flask: a very popular microframework used to develop web applications in Python.

    Flask :一种非常流行的微框架,用于用Python开发Web应用程序。

  • Pyramid: a "small, fast, down-to-earth Python web framework."

    金字塔 :“一个小型,快速,扎实的Python Web框架。”

  • Web2Py: a "free open source full-stack framework for rapid development of fast, scalable, secure and portable database-driven web-based applications."

    Web2Py :“用于快速开发快速,可扩展,安全和可移植的数据库驱动的基于Web的应用程序的免费开源全栈框架。”

  • Bottle: a "fast, simple and lightweight WSGI micro web-framework for Python."

    Bottle :“一个快速,简单,轻量级的WSGI Python微Web框架。”

学习资源 (Learning Resources)

freeCodeCamp's YouTube channel has great free tutorials to learn web development in Python:

freeCodeCamp的YouTube频道提供了许多很棒的免费教程,以学习Python的网络开发:

These are also great free resources to learn how to work with these frameworks:

这些也是免费的宝贵资源,可帮助您学习如何使用这些框架:

🔸计算机科学教育 (🔸 Computer Science Education)

Python currently plays a key role in computer science education around the world.  Let's see why.

Python目前在全世界的计算机科学教育中发挥着关键作用。 让我们看看为什么。

为什么是Python? (Why Python?)

Python is so widely used as a teaching tool because:

Python之所以被广泛用作教学工具,是因为:

  • It is easy to learn: its syntax is simple and it can be learned quickly. Students start diving into more advanced aspects of computer science much more quickly than with other programming languages.

    它易于学习:其语法简单并且可以快速学习。 与使用其他编程语言相比,学生可以更快地开始深入计算机科学的更高级方面。

  • It is powerful: it is used in real-world applications, so students immediately start acquiring valuable skills for their careers.

    它功能强大:它可用于实际应用中,因此学生可以立即开始获得其职业上宝贵的技能。

  • It is versatile: it supports various programming paradigms including imperative programming, functional programming, procedural programming, and object-oriented programming.

    它用途广泛:它支持各种编程范例,包括命令式编程,函数式编程,过程式编程和面向对象的编程。

The creator of the Python language, Guido van Rossum, stated that:

Python语言的创建者Guido van Rossum指出:

Now, it's my belief that Python is a lot easier than to teach to students programming and teach them C or C++ or Java at the same time because all the details of the languages are so much harder.
现在,我相信Python比向学生教编程和同时教他们C或C ++或Java容易得多,因为语言的所有细节都难得多。

Python's syntax is simple and straightforward, so students can start learning computational thinking and problem-solving skills much more quickly, which is usually the main goal of introductory computer science courses.

Python的语法简单明了,因此学生可以更快地开始学习计算思维和解决问题的技能,这通常是计算机科学入门课程的主要目标。

课堂和在线学习中的Python (Python in the Classroom and Online Learning)

Many universities and schools around the world have decided to teach introductory programming and computer science courses using Python.

世界各地的许多大学和学校都决定使用Python教授入门编程和计算机科学课程。

For example, MIT, one of the world's leading universities in the field of technology, teaches introductory computer science and programming using Python (both in the on-campus and online versions of the course on edX).

例如,麻省理工学院(MIT)是技术领域的世界领先大学之一,它使用python(在edX课程的校园版和在线版中)教授入门计算机科学和编程。

According to an article by MIT News published when the online version of the course reached 1.2 million enrollments, the course "has become the most popular MOOC in MIT history".

根据麻省理工学院新闻社发表的一篇文章,当该课程的在线版本注册达到120万时,该课程“已成为麻省理工学院历史上最受欢迎的MOOC”。

This clearly shows that Python's popularity continues to rise. In the article you can find testimonies of students who learned Python and how this new knowledge improved their lives.

这清楚地表明Python的受欢迎程度持续上升。 在本文中,您可以找到学习过Python的学生的见证,以及这些新知识如何改善他们的生活。

In the article, Professor Ana Bell, lecturer in the EECS Department at MIT, states that:

在本文中,麻省理工学院EECS系讲师Ana Bell教授指出:

“At its core, the 6.00 series teaches computational thinking...It does this using the Python programming language, but the course also teaches programming concepts that can be applied in any other programming language.”
“从本质上讲,6.00系列教授计算思想……它使用Python编程语言来实现,但是该课程还教授可以应用于任何其他编程语言的编程概念。”

This clearly shows the potential of Python as a teaching tool. It can be used to teach higher level concepts that can be applied to other programming languages.

这清楚地显示了Python作为教学工具的潜力。 它可用于教授可应用于其他编程语言的高级概念。

And it does this without the extra layer of complexity that the syntax of other programming languages like Java or C might add to the learning process.

这样做不会造成其他编程语言(如Java或C)的语法可能增加学习过程的复杂性。

During the last few years, online courses have become an important part of the daily lives of learners of all ages worldwide. The variety of free online courses and resources has expanded tremendously in the last few years.  

在过去的几年中,在线课程已成为全球所有年龄段学习者日常生活的重要组成部分。 在过去的几年中,免费的在线课程和资源的种类已大大增加。

For example, freeCodeCamp's curriculum includes three free certificates with projects to help you expand your Python skills in key areas with high demand worldwide:

例如, freeCodeCamp的课程包括三个带有项目的免费证书,可帮助您在全球范围内需求旺盛的关键领域扩展Python技能:

  • Scientific Computing with Python.

    使用Python进行科学计算。
  • Data Analysis with Python.

    使用Python进行数据分析。
  • Machine Learning with Python.

    使用Python进行机器学习。

Harvard University also offers these online courses that can be audited for free:

哈佛大学还提供可以免费审核的这些在线课程:

  • CS50's Introduction to Computer Science.

    CS50的计算机科学概论。
  • CS50's Web Programming with Python and JavaScript.

    CS50的使用Python和JavaScript进行Web编程。
  • CS50's Introduction to Artificial Intelligence with Python.

    CS50的Python人工智能简介。

Python has definitely become a key tool that has improved computer science education worldwide. And it will continue to do so in the future.

Python无疑已经成为改善全世界计算机科学教育的关键工具。 将来它将继续这样做。

If you are thinking about teaching a course using Python or learning Python, I guarantee you that your time and effort will be totally worth it.

如果您正在考虑使用Python教授课程或学习Python,那么我保证您的时间和精力将是完全值得的。

🔹计算机视觉与图像处理 (🔹 Computer Vision and Image Processing)

Python is used for computer vision and image processing, fields that are expanding rapidly.

Python用于计算机视觉和图像处理,这些领域正在Swift扩展。

The goal of image processing is to process an image, apply transformations to it, and return a new version of the original image.  

图像处理的目标是处理图像,对其进行转换,然后返回原始图像的新版本。

In contrast, the goal of computer vision is more complex because it tries to make the computer understand and interpret an image and its content.

相反,计算机视觉的目标更加复杂,因为它试图使计算机理解和解释图像及其内容。

图像处理 (Image Processing )

Let's start with image processing. With a Python library, you can perform operations such as:

让我们从图像处理开始。 使用Python库,您可以执行以下操作:

  • Cropping, flipping, and rotating.

    裁剪,翻转和旋转。
  • Manipulating exposure and color channels.

    操纵曝光和色彩通道。
  • Detecting edges and lines.

    检测边缘和线条。
  • Adding filters and restoring images.

    添加过滤器并还原图像。

计算机视觉 (Computer Vision )

Now let's dive into computer vision. If you start researching this topic, you might be surprised by its current applications. Some of them are:

现在,让我们深入研究计算机视觉。 如果您开始研究此主题,您可能会对它的当前应用感到惊讶。 他们之中有一些是:

  • Navigation.

    导航。
  • Object and Event Detection.

    对象和事件检测。
  • Facial recognition.

    面部识别。
  • Image classification.

    图像分类。

This scientific field is so important that Google developed a tool called Cloud Vision, which has a Python version for developers to incorporate this functionality into their programs.

这个科学领域是如此重要,以至于Google开发了一个名为Cloud Vision的工具,该工具具有Python版本,供开发人员将该功能整合到他们的程序中。

According to the "Using the Vision API with Python" tutorial in Google Codelabs, the Google Cloud Vision API:

根据Google Codelabs中的“ 将Vision API与Python结合使用 ”教程,Google Cloud Vision API:

Allows developers to easily integrate vision detection features within applications, including image labeling, face and landmark detection, optical character recognition (OCR), and tagging of explicit content.
使开发人员可以轻松地在应用程序中集成视觉检测功能,包括图像标签,面部和界标检测,光学字符识别(OCR)和显式内容的标记。

This set of tools provides functionality for face detection, landmark detection, logo detection, label detection, text detection, and more.

这套工具提供了面部检测,界标检测,徽标检测,标签检测,文本检测等功能。

💡 Tip: One of the most amazing applications of computer vision is the development of software to control self-driving cars. These vehicles need to "see" where they are driving, where the lane is, and what objects surround them (including other vehicles). Computer vision plays a key role in this functionality.

提示:计算机视觉最令人惊奇的应用之一是开发用于控制自动驾驶汽车的软件。 这些车辆需要“看”他们在哪里行驶,车道在哪里以及它们周围有什么物体(包括其他车辆)。 计算机视觉在此功能中起着关键作用。

Python库 (Python Libraries)

These are some awesome libraries for computer vision and image processing:

这些是用于计算机视觉和图像处理的出色库:

  • OpenCV: an "open source computer vision and machine learning software library". Its Python version is called OpenCV-Python.

    OpenCV :“开源计算机视觉和机器学习软件库”。 它的Python版本称为OpenCV-Python。

  • scikit-image: a "collection of algorithms used for image processing".

    scikit-image :“用于图像处理的算法的集合”。

  • NumPy: it can be used to process the pixels of an image as a 2D array.

    NumPy :可用于将图像的像素处理为2D数组。

  • SciPy: the scipy.ndimage package "contains various functions for multidimensional image processing."

    SciPyscipy.ndimage包“包含用于多维图像处理的各种功能”。

🔸游戏开发 (🔸 Game Development)

Games definitely shape lives and create timeless memories. They will continue to be part of our society in the years to come. Python is already there, lighting the spark of game creation.

游戏绝对可以塑造生活并创造永恒的回忆。 在未来的几年中,它们将继续成为我们社会的一部分。 Python已经存在,点燃了游戏创作的火花。

Python游戏开发框架 (Python Game Development Frameworks)

According to the official Python Documentation, there are two main Python frameworks used to develop games:

根据官方Python文档 ,有两个主要的Python框架用于开发游戏:

  • pygame: "the original and still very much active package for game development using Python. It allows Python to talk to SDL, a cross-platform, multimedia library. Because it needs to be compiled for each platform and each Python version, there can be a lag when a new Python version comes along."

    pygame :“使用Python进行游戏开发的原始且仍非常活跃的软件包。它允许Python与跨平台的多媒体库SDL进行通信 。因为需要针对每个平台和每个Python版本进行编译,新的Python版本问世时出现了滞后。”

  • pyglet: this is "the newcomer, based on OpenGL. Because it is a pure Python package, it can be used as is even when a new Python version is released (except for the Python 2 to Python 3 transition)."

    pyglet :这是“基于OpenGL的新手。因为它是纯Python软件包,所以即使发布了新的Python版本(从Python 2到Python 3的过渡除外),也可以照常使用。”

You can also use the turtle module to create simple games. Turtle is a built-in Python module that is installed automatically when you install Python in your computer. It helps you to create games with simple graphics and with a simple user interface.

您还可以使用turtle模块创建简单的游戏。 Turtle是内置的Python模块,当您在计算机中安装Python时会自动安装。 它可以帮助您创建具有简单图形和简单用户界面的游戏。

学习资源 (Learning Resources)

If you want learn game development in Python, freeCodeCamp's YouTube channel has these great free tutorials:

如果您想用Python学习游戏开发,freeCodeCamp的YouTube频道提供了以下出色的免费教程:

🔹医学与药理学 (🔹 Medicine and Pharmacology)

Python also has amazing applications in the medical field. You will be surprised by how technology is being combined with medical knowledge to provide accurate and efficient diagnoses and treatments to patients.

Python在医学领域也有惊人的应用程序。 您将对技术与医学知识相结合以为患者提供准确有效的诊断和治疗感到惊讶。

应用领域 (Applications)

Some examples of the use of Python in medicine and pharmacology include:

在医学和药理学中使用Python的一些示例包括:

  • Making clinical diagnoses based on the patients' medical records and symptoms.

    根据患者的病历和症状进行临床诊断。
  • Analyzing medical data.

    分析医疗数据。
  • Making computational models to speed up the process of development of new medications.

    建立计算模型以加快新药物的开发过程。

These broad applications include thousands and thousands of examples around the world. I selected a few of them to illustrate how Python is shaping this field. Let's take a look at them.

这些广泛的应用程序包括全世界成千上万的示例。 我选择了其中一些来说明Python如何塑造这个领域。 让我们看看它们。

制药成功案例:阿斯利康 (Pharmaceutical Success Story: AstraZeneca)

According to the official Python Documentation, one of the world's leading pharmaceutical companies, AstraZeneca, used Python to improve their existing computational models to make them "more robust, extensible, and maintainable".

根据官方的Python文档 ,世界领先的制药公司之一阿斯利康(AstraZeneca )使用Python改进了现有的计算模型,以使其“更健壮,可扩展且可维护”。

Researchers used these models simulate the chemical structure of molecules and their effect in the body. This helped scientists identify potential molecules for new drugs and start testing them more quickly in the laboratory.

研究人员使用这些模型来模拟分子的化学结构及其在人体中的作用。 这有助于科学家识别新药的潜在分子,并开始在实验室中更快地对其进行测试。

When he joined the team, Andrew Dalke, being a a "well-known advocate for Python in computational chemistry and biology" convinced the team that Python was exactly what they needed.

当他加入团队时,曾是“计算化学和生物学中Python的著名倡导者”的Andrew Dalke让团队确信Python正是他们所需要的。

Python was chosen for this work because it is one of the best languages available for physical scientists, that is, for people who do not have a computer science background.
之所以选择Python,是因为它是物理科学家(即没有计算机科学背景的人)可以使用的最佳语言之一。

He stated that:

他说:

Python was designed to solve real-world problems faced by an expert programmer. The result is a language that scales well from small scripts written by a chemist to large packages written by a software developer.
Python旨在解决专家程序员面临的现实问题。 结果是一种语言可以很好地扩展,从化学家编写的小脚本到软件开发人员编写的大软件包。

Amazing, right? Python can power the computational models that pharmaceutical laboratories use to develop new drugs.

太好了吧? Python可以为制药实验室用来开发新药物的计算模型提供支持。

红细胞(RBC)鉴定 (Red Blood Cells (RBC) Identification)

Another interesting medical application of Python is related to Hematology. Usually, specialized professionals analyze blood tests by counting and identifying cells manually, but this can be improved with the help of automation.

Python的另一个有趣的医学应用与血液学有关。 通常,专业人士通过手动计数和识别细胞来分析血液测试,但是可以借助自动化来改善这一点。

Researchers found that Python can be the right tool for the job. Let's see an interesting project.

研究人员发现Python可能是完成这项工作的正确工具。 让我们看一个有趣的项目。

IdentiCyteThe goal of this project is to identify and classify red blood cells shapes based on images taken from optical microscopes. According to this article, "RBC shape can help to diagnose diseases and disorders such as leukaemia, sickle cell anaemia and malaria."

IdentiCyte该项目的目的是基于光学显微镜拍摄的图像来识别和分类红细胞的形状。 根据这篇文章 ,“ RBC形状可以帮助诊断疾病和病症,例如白血病,镰状细胞性贫血和疟疾。”

The project was developed by researchers from the Bioresource Processing Research Institute Australia. It was programmed in Python and it used image processing Python packages and libraries such as numpy, scipy, opencv-python, scikit-learn, and matplotlib.

该项目是由澳大利亚生物资源加工研究所的研究人员开发的。 它使用Python编程,并使用图像处理Python软件包和库,例如numpy,scipy,opencv-python,scikit-learn和matplotlib。

Python医疗包 (Python Medical Packages)

  • pyGeno: an open-source Python package developed by Tariq Daouda at the Institute for Research in Immunology and Cancer (IRIC). It's intended for "precision medicine applications that revolve around genomics and proteomics". It works with reference and personalized genomes.

    pyGeno :由Tariq Daouda在免疫学和癌症研究所( ICRIC )研发的开源Python软件包。 它旨在用于“围绕基因组学和蛋白质组学的精密医学应用”。 它可与参考基因和个性化基因组一起使用。

  • MedPy: an open-source Python library "for medical image processing in Python, providing basic functionalities for reading, writing and manipulating large images of arbitrary dimensionality."

    MedPy :一个开放源代码的Python库,“用于Python中的医学图像处理,提供用于读取,写入和处理任意维数大图像的基本功能。”

实际医疗应用(示例) (Real-World Medical Applications (Examples))

🔸生物与生物信息学 (🔸 Biology and Bioinformatics)

Python also has amazing applications in the world of Biology and Bioinformatics. These include processing DNA sequences, simulating population dynamics and genetics, and modeling biochemical structures.

Python在生物学和生物信息学领域也有惊人的应用程序。 其中包括处理DNA序列,模拟种群动态和遗传学以及对生化结构进行建模。

生物蟒 (Biopython)

Biopython is a Python framework with "freely available tools for biological computation". Its goal is to "address the needs of current and future work in bioinformatics."

Biopython是一个Python框架,带有“免费的生物计算工具”。 其目标是“满足当前和未来生物信息学工作的需求”。

According to its documentation, this framework includes functionality such as the ability to:

根据其文档 ,此框架包括以下功能:

  • Work with sequences and perform common operations on them such as transcription, translation, and weight calculations.

    处理序列并对其进行通用操作,例如转录,翻译和权重计算。
  • Connect with biological databases.

    与生物学数据库连接。
  • Perform classification of data using K-Nearest Neighbors, Naive Bayes, and Support Vector Machines.

    使用K最近邻居,朴素贝叶斯和支持向量机执行数据分类。
  • Work with phylogenetic trees and population genetics.

    处理系统树和种群遗传学。

The documentation states that "the goal of Biopython is to make it as easy as possible to use Python for bioinformatics by creating high-quality, reusable modules and classes."

文档指出:“ Biopython的目标是通过创建高质量,可重用的模块和类,使其尽可能容易地将Python用于生物信息学。”

Rosalind:通过解决生物信息学挑战来练习Python (Rosalind: Practice Python by Solving Bioinformatics Challenges)

Rosalind is "a platform for learning bioinformatics through problem solving." It is "free and open to the public" (the FAQ page indicates that it is in beta mode).

Rosalind是“通过解决问题来学习生物信息学的平台”。 它是“免费的并向公众开放”(“常见问题”页面指示它处于beta模式)。

Python can be used to solve the challenges on the platform. Since this is a very popular programming language in the platform, there is a "Python Village" section where you can learn the basics of Python before tackling bioinformatics algorithms.

Python可用于解决平台上的挑战。 由于这是平台上非常流行的编程语言,因此有一个“ Python村 ”部分,您可以在学习生物信息学算法之前学习Python的基础知识。

Users solve the problems by running their solutions on their computer, processing the given dataset, and copy/pasting the output to check the answer.

用户通过在计算机上运行其解决方案,处理给定的数据集并复制/粘贴输出以检查答案来解决问题。

💡 Tip: The project's name commemorates Rosalind Franklin, "whose X-ray crystallography with Raymond Gosling facilitated the discovery of the DNA double helix by Watson and Crick".

提示:该项目的名称是纪念罗莎琳德·富兰克林 ( Rosalind Franklin)所为 ,“他与雷蒙德·高斯林(Raymond Gosling)进行的X射线晶体学研究促进了沃森(Watson)和克里克(Crick)发现DNA双螺旋结构”。

包和框架 (Packages and Frameworks )

  • ProDy: a free and open-source package "for protein structural dynamics analysis" developed by Bahar Lab at the University of Pittsburgh.

    ProDy :由匹兹堡大学的Bahar Lab开发的“用于蛋白质结构动力学分析”的免费开源软件包。

  • PySB: a "framework for building mathematical models of biochemical systems as Python programs" developed by members of the Lopez Lab at Vanderbilt University and the Sorger Lab at Harvard Medical School.

    PySB 范德比尔特大学洛佩兹实验室和哈佛医学院索尔格实验室的成员开发的“构建作为Python程序的生化系统数学模型的框架”。

  • The Community Simulator: this is a "freely available Python package for simulating microbial population dynamics in a reproducible, transparent and scalable way" developed by researchers at Boston University.

    社区模拟器:这是由波士顿大学研究人员开发的“可重现,透明和可扩展的方式免费提供的Python软件包,用于模拟微生物种群动态”。

💡 Tip: If you would like to learn more about the applications of Python in Bioinformatics, here's a talk by Martin Schweitzer at PyCon Australia: "Python for Bioinformatics for learning Python".

提示:如果您想了解有关Python在生物信息学中的应用的更多信息,这是澳大利亚PyCon的Martin Schweitzer的演讲:“ 用于学习Python的生物信息学的Python ”。

🔹神经科学与心理学 (🔹 Neuroscience and Psychology)

Python also has applications in neuroscience and experimental psychology research.

Python在神经科学和实验心理学研究中也有应用。

神经科学中的Python (Python in Neuroscience)

According to the article Python in neuroscience written by researchers from the Center for Brain Simulation, Ecole Polytechnique Fédérale de Lausanne, Geneva, Switzerland:

根据瑞士日内瓦洛桑联邦理工学院脑仿真中心的研究人员写的神经科学中的Python文章:

Computation is becoming essential across all sciences, for data acquisition and analysis, automation, and hypothesis testing via modeling and simulation.
对于通过建模和仿真进行数据采集和分析,自动化以及假设检验而言,计算在所有科学领域都变得至关重要。

In regards to Python, they state that:

关于Python,他们声明:

It became clear to us in 2007 that we were on the cusp of an emerging Python in neuroscience ecosystem, particularly in computational neuroscience and neuroimaging, but also in electrophysiological data analysis and in psychophysics.

在2007年,对我们很明显,我们正处于神经科学生态系统中新兴Python的风口浪尖,特别是在计算神经科学和神经影像学,以及电生理数据分析和心理物理学中。

As you can see, Python and computation have been expanding across all sciences.

如您所见,Python和计算已在所有科学领域扩展。

精神病学 (PsychoPy)

PsychoPy is "an open-source package for running experiments in Python" supported by the University of Nottingham. According to the official Documentation of this package:

PsychoPy是由诺丁汉大学支持的“用于在Python中运行实验的开源软件包”。 根据该软件包的官方文档

It is used by many labs worldwide for psychophysics, cognitive neuroscience and experimental psychology.
全球许多实验室将其用于心理物理学,认知神经科学和实验心理学。

The official website of this package states that it is:

该软件包的官方网站上指出:

  • Easy for learning.

    易于学习。
  • Precise enough for Psychophysics.

    足够精确的心理物理学。
  • Flexible.

    灵活。
  • Online or lab-based depending on the user's choice.

    在线或基于实验室,具体取决于用户的选择。

🔸天文学 (🔸 Astronomy)

Python also has applications in Astronomy and Astrophysics. Let's see three of the main Python packages used in this scientific area:

Python在天文学和天体物理学中也有应用。 让我们看看该科学领域中使用的三个主要Python软件包:

(Astropy)

The Astropy package "contains various classes, utilities, and a packaging framework intended to provide commonly-used astronomy tools."

Astropy包“包含各种类,实用程序和旨在提供常用天文学工具的包框架”。

Astropy is part of a larger project called The Astropy Project, which is "is a community effort to develop a common core package for Astronomy in Python and foster an ecosystem of interoperable astronomy packages."

Astropy是名为The Astropy Project的较大项目的一部分,该项目是“社区为开发Python中的天文学通用核心软件包并建立可互操作的天文学软件包的生态系统而做出的努力”。

According to its About page, one of its goals is to "improve usability, interoperability, and collaboration between astronomy Python packages."

根据其About页面,其目标之一是“改善天文学Python软件包之间的可用性,互操作性和协作”。

💡 Tip: You can see examples of projects made with Astropy in the Example Gallery.

提示:您可以在示例库中查看使用Astropy进行的项目的示例

SunPy (SunPy)

The SunPy package is described as "the community-developed, free and open-source solar data analysis environment for Python." It builds upon the capabilities of Python packages such as NumPy, SciPy, Matplotlib, and Pandas.

SunPy软件包被描述为“社区开发的,用于Python的免费开源太阳能数据分析环境”。 它建立在Python软件包(如NumPy,SciPy,Matplotlib和Pandas)的功能之上。

太空飞人 (SpacePy)

The SpacePy package is "a package for Python, targeted at the space sciences, that aims to make basic data analysis, modeling and visualization easier."

SpacePy软件包是“面向太空科学的Python软件包,旨在简化基本数据分析,建模和可视化。”

According to its official Documentation:

根据其官方文档

The SpacePy project seeks to promote accurate and open research standards by providing an open environment for code development.
SpacePy项目旨在通过提供开放的代码开发环境来促进准确和开放的研究标准。

According to the description of its GitHub repository, it has superposed epoch classes, drift shell tracing, access to magnetic field models, streamline tracing, bootstrap confidence limits, time and coordinate conversions, and more.

根据其GitHub存储库的描述,它具有叠加的纪元类,漂移壳跟踪,对磁场模型的访问,流线型跟踪,自举置信度限制,时间和坐标转换等。

🔹其他应用 (🔹 Other Applications)

Python can also be applied in many other areas, including:

Python也可以应用于许多其他领域,包括:

  • Robotics: Python can be used to program robots. A library written for this purpose is pybotics, "an open-source Python toolbox for robot kinematics and calibration".

    机器人: Python可用于对机器人进行编程。 为此目的编写的库是pybotics ,“用于机器人运动学和标定的开源Python工具箱”。

  • Autonomous vehicles: Python can be used to program the software that controls self-driving cars. These cars need computer vision to "see" where they are driving, where the lane is, and what objects surround them.

    自动驾驶汽车: Python可用于对控制自动驾驶汽车的软件进行编程。 这些汽车需要计算机视觉才能“看到”他们在哪里行驶,在哪里车道以及周围有什么物体。

  • Meteorology: The package climate-indices "contains Python implementations of various climate index algorithms which provide a geographical and temporal picture of the severity of precipitation and temperature anomalies useful for climate monitoring and research."

    气象学气候索引包“包含各种气候指数算法的Python实现,这些算法提供了对气候监测和研究有用的降水和温度异常严重程度的地理和时间图。”

  • Business: Python can be a powerful tool to analyze data generated by businesses and to forecast future trends.

    业务: Python可以成为分析业务产生的数据并预测未来趋势的强大工具。

  • Graphical User Interface (GUI) Development: Python can be used to create graphical user interfaces with tools like tkinter.

    图形用户界面(GUI)开发 :可以使用Python使用tkinter之类的工具来创建图形用户界面。

  • If you're interested in learning more about this, freeCodeCamp has a great tutorial on YouTube: Tkinter Course - Create Graphic User Interfaces in Python Tutorial.

    如果您想了解更多有关此的知识,freeCodeCamp在YouTube上有一个很棒的教程: Tkinter课程-在Python教程中创建图形用户界面。

综上所述 (In Summary)

There are many applications of Python in every area that you can possibly imagine. I hope that this article gave you an idea of the wide range of real-world applications of this programming language in industries that are currently shaping our world.  

您可能会想到的每个领域都有许多Python应用程序。 我希望本文能使您对这种编程语言在当前正在塑造我们世界的行业中在现实世界中的广泛应用有所了解。

Remember that no matter which field you are in or which field you want to be in, learning Python will definitely open many doors for you. It is here to stay. And it has transformed and improved our current world and it will continue to do so for many years.

请记住,无论您处于哪个领域或想要成为哪个领域,学习Python无疑都会为您打开许多大门。 它在这里停留。 它已经改变并改善了我们当前的世界,并将在许多年内继续如此。

I really hope that you liked my article and found it helpful. Check out my online courses. Follow me on Twitter. 👍

我真的希望您喜欢我的文章并认为对您有所帮助。 查看我的在线课程 。 在Twitter上关注我。 👍

翻译自: https://www.freecodecamp.org/news/what-is-python-used-for-10-coding-uses-for-the-python-programming-language/

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值