如何运用Anaconda帮助Python编程

2020-02-2309:18:38后端程序开发Comments2,345 views字数 3802阅读模式
如何运用Anaconda帮助Python编程文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

图源:Pexels文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

Anaconda是一个供数据科学家、IT专家,和商业领袖使用的数据科学平台,是Python、R语言等的一个发行版。针对数据科学,它有超过300个软件包,因此它迅速攀升为最好的数据平台之一。本篇导修将会探讨如何运用Anaconda帮助Python编程。以下是本文要探讨的主题:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

  • Anaconda介绍
  • 安装和启动
  • 如何将Python库导入Anaconda
  • AnacondaNavigator
  • 使用场景:

○ Python基础文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

○ 数据分析文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

○ 机器学习和人工智能文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

*CDH:Cloudera’s Distribution Including Apache Hadoop.文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

Cloudera包括Apache Hadoop的发行版本。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

如何运用Anaconda帮助Python编程

Anaconda介绍文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

Anaconda是Python和R的开源发行版本。它能够用于数据科学,机器学习,深度学习等领域。它能够让用户接触到超过300个数据库,因此对于任何程序员而言,Anaconda都是数据科学研究的上选。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

如何运用Anaconda帮助Python编程

Anaconda能够帮助简化软件包的管理和部署,它还匹配了多种工具,可以使用各种机器学习和人工智能算法轻松地从不同的来源收集数据。Anaconda还可以使用户获得一个易于管理的环境设置——用户只需点击按钮就可以部署任何项目。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

相信你们对Anaconda已经有了一个基本概念,接下来了解如何安装它,并设置一个能够在系统上工作的环境。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

如何运用Anaconda帮助Python编程

安装和启动文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

想要安装Anaconda,可以进入这个网站。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

如何运用Anaconda帮助Python编程文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

下载页面文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

选择一个适合的版本然后点击下载。完成下载后,打开启动页面。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

如何运用Anaconda帮助Python编程文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

Anaconda启动文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

遵循启动页中的指令,记得点击添加Anaconda到路径环境变量里。安装完成后,你会看到一个和下图一样的窗口:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

如何运用Anaconda帮助Python编程文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

安装完成文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

安装完成后,打开Anaconda prompt并输入jupyternotebook*。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

*Jupyter Notebook: 是一个基于Web的交互式计算环境,用于创建jupyter notebook文档。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

如何运用Anaconda帮助Python编程文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

Anaconda prompt文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

你会看到一个和下图一样的窗口:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

如何运用Anaconda帮助Python编程文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

Jupyter Notebook文件查找器文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

现在,已经知道如何将anaconda应用到python里了,继续研究如何在anaconda里为不同的项目导入数据库。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

导入Python库至Anaconda文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

打开Anaconda prompt,检查数据库是否已经安装。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

如何运用Anaconda帮助Python编程文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

检查NumPy*是否安装文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

*NumPy是Python语言的一个扩展程序库,支持高端大量的维度数组与矩阵运算,此外也针对数组运算提供大量的数学函数库。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

因为没有名为numpy的模块存在,我们要运行以下指令来安装numpy。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

如何运用Anaconda帮助Python编程文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

安装NumPy中文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

安装完成,就会出现这样一个窗口:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

如何运用Anaconda帮助Python编程文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

NumPy安装完成文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

安装完一个数据库后,尽量再次导入模块以验证安装是否成功。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

如何运用Anaconda帮助Python编程文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

导入NumPy文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

如上图所示,这一步没有出现错误。这就是在Anaconda中安装不同数据库的方法。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

Anaconda Navigator文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

如何运用Anaconda帮助Python编程文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

Anaconda Navigator文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

Anaconda Navigator是Anaconda发行版附带的桌面图形用户界面(GUI),它能够让用户在不使用命令行的情况下启动应用程序,并管理conda软件包和环境。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

如何运用Anaconda帮助Python编程

Python基础文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

如何运用Anaconda帮助Python编程文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

变量和数据类型文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

变量和数据类型是所有编程语言的基本组成部分。基于不同数据的属性,Python共有六种数据类型。其中,列表(list),字典(dictionary),集合(set),还有元组(tuple)是Python中的集合数据类型。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

下面是变量和数据类型在Python中应用的例子:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

#variable declaration文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

name = "Edureka"文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

f = 1991文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

print("python wasfounded in" , f)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

#data types文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

a = [1,2,3,4,5,6,7]文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

b = {1 : 'edureka' , 2: 'python'}文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

c = (1,2,3,4,5)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

d = {1,2,3,4,5}文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

print("the listis" , a)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

print("thedictionary is" ,b)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

print("the tupleis" , c)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

print("the set is" , d)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

操作符(Operators)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

Python 中的操作符用于值或变量之间的操作。Python中有七种类型的操作符:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

  • 赋值操作符(AssignmentOperator)。
  • 算术运算符(ArithmeticOperator)。
  • 逻辑运算符(LogicalOperator)。
  • 比较操作符(ComparisonOperator)。
  • 位操作符(Bit-wiseOperator)。
  • 会员操作符(MembershipOperator)。
  • 身份识别操作符(Identity Operator)。

下面是在Python中使用操作符的一个例子:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

a = 10文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

b = 15文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

#arithmetic operator文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

print(a + b)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

print(a - b)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

print(a * b)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

#assignment operator文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

a += 10文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

print(a)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

#comparison operator文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

#a != 10文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

#b == a文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

#logical operator文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

a < b and a < 10文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

#this will return true if both the statements are true.文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

控制语句文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

诸如使用if, else, break和continue等的语句被用作控制语句,以获得对执行过程的控制,从而取得最佳结果。可以在 Python 的循环中使用这些语句来控制结果。下面的示例演示如何使用控制(control)条件(conditional)语句。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

name = 'edureka'文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

for i in name:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

if i == 'a':文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

break文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

else:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

print(i)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

函数文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

Python函数以一种高效的方式使代码的重复使用性提高,为问题语句编写逻辑,并运行一些参数以获得最佳解决方案。下面是如何在python中使用函数的示例。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

deffunc(a):文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

return a ** a文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

res = func(10)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

print(res)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

类以及对象文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

因为Python支持面向对象的程序设计,所以也可以使用类和对象。下面是如何使用python中的类和对象的示例。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

classParent:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

deffunc(self):文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

print('this is parent')文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

classChild(Parent):文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

deffunc1(self):文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

print('this is child')文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

ob = new Child()文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

()文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

以上Python的一些基本概念。接下来,看看Anaconda更大的软件包支持,我们可以从许多库中获得资料。现在来探究如何使用 python anaconda进行数据分析。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

如何运用Anaconda帮助Python编程

分析文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

如何运用Anaconda帮助Python编程文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

数据挖掘和分析工作流文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

上面是数据分析中涉及的某些步骤。来看看在anaconda中数据分析是如何进行数据分析的,以及其中可以使用的各种库。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

收集数据文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

数据的收集就像在程序中加载 CSV 文件一样简单。可以利用相关数据来分析数据中的特定实例或条目。下面是加载程序中CSV数据的代码:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

import pandas as pd文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

import numpy as np文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

import matplotlib.pyplot as plt文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

import seaborn as sns文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

df = pd.read_csv(')文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

print((5))文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

如何运用Anaconda帮助Python编程文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

前五行数据组文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

交叉分析文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

在加载程序中的数据集之后,还需要对数据进行一些更改过滤,即消除空值和可能造成分析不确定性的不必要字段。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

下面是如何根据需求筛选数据的示例:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

print(().sum())文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

#this will give the sum of all the null values in thedataset.文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

df1 = df.dropna(axis=0 , how= 'any')文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

#this will drop rows with null values文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

如何运用Anaconda帮助Python编程文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

找到每列空值的总数文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

当然也可以删除空值。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

如何运用Anaconda帮助Python编程文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

删除空值的所在行文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

箱线图(box plot)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

(x=df['Salary Range From'])文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

(x=df['Salary Range To'])文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

如何运用Anaconda帮助Python编程文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

薪资范围箱线图文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

如何运用Anaconda帮助Python编程文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

薪资范围箱线图文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

散点图(scatter plot)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

import matplotlib.pyplot as plt文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

fig, ax = plt.subplots(figsize=(16,8))文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

(df['Salary Range From'] , df['Salary Range To'])文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

('Salary Range From')文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

('Salary Range TO')文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

()文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

如何运用Anaconda帮助Python编程文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

薪资范围散点图文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

可视化文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

一旦根据需求改变了数据,就有必要分析这些数据,方式之一就是将结果可视化。更好的可视化表示有助于对数据投影进行最优分析。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

下面是一个数据可视化的例子:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

如何运用Anaconda帮助Python编程文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

全职&兼职工作者的柱状图文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

如何运用Anaconda帮助Python编程文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

全职&兼职工作者及工资结算方式柱状图文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

如何运用Anaconda帮助Python编程文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

薪资范围直方图文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

如何运用Anaconda帮助Python编程文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

薪资范围直方图文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

import matplotlib.pyplot as plt文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

fig = plt.figure(figsize = (10,10))文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

ax = ()文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

((), annot=True, fmt=".2f")文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

("Correlation",fontsize=5)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

()文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

如何运用Anaconda帮助Python编程文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

用matplotlib绘制的热图文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

分析文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

完成可视化后,可以借助各种图表来进行分析。假设我们正在处理作业数据,通过查看某个区域中特定作业的可视化表示,便可以确定特定域中作业的数量。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

根据上文的分析,可以假设下列结果:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html

  • 和全职工作相比,数据集里兼职工作的数量非常少。
  • 兼职工作只有不到500个,但全职工作的总数超过了2500个。
  • 基于这一分析,可以建立一个预测模型。
文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/17832.html
  • 本站内容整理自互联网,仅提供信息存储空间服务,以方便学习之用。如对文章、图片、字体等版权有疑问,请在下方留言,管理员看到后,将第一时间进行处理。
  • 转载请务必保留本文链接:https://www.cainiaoxueyuan.com/bc/17832.html

Comment

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定