当前位置: 首页 > news >正文

广州网站设计找谁网站开发的项目内容

广州网站设计找谁,网站开发的项目内容,在线培训平台哪家好,wordpress get_category_parents上一篇文章我记录了自己在入门 Python 学习的一些基础内容以及实际操作代码时所碰到的一些问题。这篇我将会记录我在学习和运用 Python 进行数据分析的过程#xff1a;介绍 Numpy 和 Pandas 两个包运用 Numpy 和 Pandas 分析一维、二维数据数据分析的基本过程实战项目【用 Pyt…上一篇文章我记录了自己在入门 Python 学习的一些基础内容以及实际操作代码时所碰到的一些问题。这篇我将会记录我在学习和运用 Python 进行数据分析的过程介绍 Numpy 和 Pandas 两个包运用 Numpy 和 Pandas 分析一维、二维数据数据分析的基本过程实战项目【用 Python 分析朝阳医院2018季度的药物销售数据】一、简单介绍 Numpy 和 Pandas 两个包NumPy 和 pandas 是 Python 常见的两个科学运算的包提供了比 Python 列表更高级的数组对象且运算效率更高。常用于处理大量数据并从中提取、分析有用指标。NumPy 是 Numerical Python 的简称 它是目前 Python 数值计算中最为重要的基础包。大多数计算包都提供了基于 NumPy 的科学函数功能将 NumPy 的数组对象作为数据交换的通用语。NumPy 的核心是 ndarray 对象它封装了 Python 的原生数据类型的N维数组。NumPy 创建的数组在创建时就要有固定大小数组元素需要有相同的数据类型NumPy 也可以像Python 数组一样使用切片。矢量化和广播是 Numpy 的特性。pandas 所包含的数据结构和数据梳理工具的设计使得在 Python 中 进行数据清晰和分析非常快捷。pandas 经常是和其它数值计算工具比如 NumPy 和 SciPy以及数据可视化工具比如 matplotlib 一起使用的。 pandas 支持大部分 NumPy 语言风格的数组计算。pandas 可以直观的描述一维和二维数据结构分别是 Series 对象和 DataFrame 对象理解起来很直观清晰。pandas 可以处理多种不同的数据类型可以处理缺失数据可以分组和聚合也支持切片功能。二、运用 NumPy 和 pandas 分析一维、二维数据首先在 conda 中安装这两个包安装命令conda install numpy, pandas Install two packages in conda, installation command: conda install numpy, pandas# import numpy package import numpy as np # import pandas package import pandas as pd运用 NumPy 分析一维数据1.1 定义一维数组定义一维数组 array参数传入的是一个列表 [2,3,4,5] Definition: One dimension array, parameters passed was a list[2,3,4,5]a np.array([2,3,4,5])1.2 查询# check items a[0]21.3 切片访问 - 获取指定序号范围的元素# section acess: Acquired items from designated range series number # a[1:3] Acquired items from series no. 1 to series no.3 a[1:3]array([3, 4])1.4 查询数据类型 dtype detail info link reference: https://docs.scipy.org/doc/numpy-1.10.1/reference/arrays.dtypes.html# Check data types a.dtypedtype(int32)1.5 统计计算 - 平均值# Statistical caculation # mean a.mean()3.51.6 统计计算 - 标准差# standard deviation a.std()1.1180339887498951.7 向量化运行 - 乘以标量# vectorization: multiply scalar b np.array([1,2,3]) c b * 4 carray([ 4, 8, 12])2. 运用 NumPy 分析二维数据2.1 定义二维数组 Numpy Two-dimensional data structure: Array# Define Two-dimensional data array a np.array([[1,2,3,4],[5,6,7,8],[9,10,11,12] ])2.2 获取元素获取行号是0列号是2的元素# Acquire the items that row number is 0, and Column number is 2 a[0,2]32.3 获取行获取第1行 # Acquire first row items a[0,:]array([1, 2, 3, 4])2.4 获取列获取第1列 # Acquire first column items a[:,0]array([1, 5, 9])2.5 NumPy数轴参数axis1) 如果没有指定数轴参数会计算整个数组的平均值 If the axis parameters is not designated, the mean of the entire array will be calculated a.mean()6.52) 按轴计算axis1 计算每一行# caculate according to axis: axis 1 , caculate evey single row a.mean(axis 1)array([ 2.5, 6.5, 10.5])3) 按轴计算axis0 计算每一列a.mean(axis 0)array([5., 6., 7., 8.])3. 运用 pandas 分析一维数据3.1 定义 Pandas 一维数据结构定义 Pandas 一维数据结构 - Series Definition: Pandas One Dimension Data Analysis: Series One day stock price saved for 6 companies(USD), Tenent 427 HKD equal to 54.74 USD.stockS pd.Series([54.74, 190.9, 173.14, 1050.3, 181.86, 1139.49],index [tencent,alibaba,apple,google,facebook,amazon])3.2 查询查询 stockSstockStencent 54.74alibaba 190.90apple 173.14google 1050.30facebook 181.86amazon 1139.49dtype: float643.3 获取描述统计信息# Acquired describe statistical info stockS.describe()count 6.000000mean 465.071667std 491.183757min 54.74000025% 175.32000050% 186.38000075% 835.450000max 1139.490000dtype: float643.4 iloc属性用于根据索引获取值stockS.iloc[0]54.743.5 loc属性用于根据索引获取值# loc attribution: used to acquire value according to the index stockS.loc[tencent]54.743.6 向量化运算 - 向量相加# vectorization: vectors addition s1 pd.Series([1,2,3,4], index [a,b,c,d]) s2 pd.Series([10,20,30,40], index [a,b,e,f]) s3 s1 s2 s3a 11.0b 22.0c NaNd NaNe NaNf NaNdtype: float643.7 删除缺失值# Method 1: Delete missing value s3.dropna()a 11.0b 22.0dtype: float643.8 填充缺失值# Filled up the missing values s3 s2.add(s1, fill_value 0) s3a 11.0b 22.0c 3.0d 4.0e 30.0f 40.0dtype: float644. 运用 pandas 分析二维数据pandas 二维数组数据框DataFrame4.1 定义数据框 Pandas Two-dimensional array: DataFrame# Step1: Define a dict, Mapping names and corresponding values salesDict {medecine purchased date:[01-01-2018 FRI,02-01-2018 SAT,06-01-2018 WED],social security card number:[001616528,001616528,0012602828],commodity code:[236701,236701,236701],commodity name:[strong yinqiao VC tablets, hot detoxify clearing oral liquid,GanKang compound paracetamol and amantadine hydrochloride tablets],quantity sold:[6,1,2],amount receivable:[82.8,28,16.8],amount received:[69,24.64,15] }# import OrdererDict from collections import OrderedDict# Define an OrderedDict salesOrderDict OrderedDict(salesDict)# Define DataFrame: passing Dict, list name salesDf pd.DataFrame(salesOrderDict)4.2 查看salesDf4.3 平均值是按每列来求平均值# mean: caculating according to columns salesDf.mean()commodity code 236701.000000quantity sold 3.000000amount receivable 42.533333amount received 36.213333dtype: float644.4 查询数据 - iloc属性用于根据位置获取值1) 查询第1行第2列的元素 iloc attributes used to acquired value according to position# check items at 1st row and 2nd column salesDf.iloc[0,1] 001616528 2) 获取第1行 - 代表所有列# Acquired all items of first row - collect every single colum salesDf.iloc[0,:]medecine purchased date 01-01-2018 FRIsocial security card number 001616528commodity code 236701commodity name strong yinqiao VC tabletsquantity sold 6amount receivable 82.8amount received 69Name: 0, dtype: object3) 获取第1列 - 代表所有行# Acquired all items of first column - collect every single row salesDf.iloc[:,0]0 01-01-2018 FRI1 02-01-2018 SAT2 06-01-2018 WEDName: medecine purchased date, dtype: object4.5 查询数据 - loc属性用于根据索引获取值1) 获取第1行 loc attributes used to acquired value according to index# Check items from first row first column salesDf.loc[0,medecine purchased date]01-01-2018 FRI2) 获取“商品编码”这一列# Acquired all items of column commodity code # Method 1: salesDf.loc[:,commodity code]0 2367011 2367012 236701Name: commodity code, dtype: int643) 简单方法获取“商品编码”这一列# Acquired all items of column commodity code # Method 2: Easy way salesDf[commodity code]0 2367011 2367012 236701Name: commodity code, dtype: int644.6 数据框复杂查询 - 切片功能1) 通过列表来选择某几列的数据# Select a few column data via list salesDf[[commodity name,quantity sold]]2通过切片功能获取指定范围的列# Acquired data from define range of column via section salesDf.loc[:,medecine purchased date:quantity sold]4.7 数据框复杂查询 - 条件判断1) 通过条件判断筛选 - 第1步构建查询条件# Select via condition test # Step 1: Establish query condition querySer salesDf.loc[:,quantity sold] 1 type(querySer)pandas.core.series.SeriesquerySer0 True1 False2 TrueName: quantity sold, dtype: boolsalesDf.loc[querySer,:]4.8 查看数据集描述统计信息1 ) 读取 Ecxcel 数据# Read data from Excel fileNameStr C:UsersUSERDesktop#3Python3_The basic process of data analysisSales data of Chaoyang Hospital in 2018 - Copy.xlsx xls pd.ExcelFile(fileNameStr) salesDf xls.parse(Sheet1)2) 打印出前3行以确保数据运行正常# Print first three row to make sure data can work properly salesDf.head(3)3) 查询行、列总数salesDf.shape(6578, 7)4查看某一列的数据类型# Check the data type of one column salesDf.loc[:,quantity sold].dtypedtype(float64)5查看每一列的统计数值# Check the statistics for each column salesDf.describe()下一篇我将继续后半部分的学习数据分析的基本过程实战项目【用 Python 分析朝阳医院2018季度的药物销售数据】
http://www.pierceye.com/news/653653/

相关文章:

  • wordpress建站容易吗食品饮料网站源码
  • 做网站还有市场吗建一个网站花费
  • 惠州网站建设哪里有wap网站生成
  • 长沙网站外包公司吗搭建wordpress博客系统
  • 通州企业网站建设做网站合成APP
  • 深圳观澜网站建设室内设计软件手机版
  • 苏州建设网站服务国外做家装的网站有哪些
  • 做导航网站赚钱吗大兴区营销网络推广行业
  • 红衫中国网站建设福建手机版建站系统开发
  • 做平面的网站wordpress授权主题
  • 如何做织梦论坛类的网站官网建设目的
  • 安徽网新科技有限公司 网站开发静态网页报告
  • 营销做网站公司怎么做国际货运代理外贸网站
  • 网站建设部署与发布有效期宝石网站建设
  • 网站建设有什么需求分析现在网站都是拿什么软件做的
  • 网站建设需求分析报告撰写阿里云建设网站流程
  • 网站导航栏设计要求seo搜索引擎的优化
  • 杭州做商务网站全屋定制自己设计
  • 汉中定制网站建设公司南昌公司注册
  • 商务网站建设流程步骤小型公司注册资金写多少合适
  • 台州公司网站外包自己做网站运营
  • 聚名网站专业团队p图
  • 网站推广排名收费徐家汇网站建设
  • 做app软件大概多少钱宁波seo优化项目
  • 网站建设土豆视频教程最专业微网站首选公司
  • 合肥做检查军大网站家装公司名称
  • 网站搜索怎么做的苏州网站建设介绍
  • 免费微网站建设地图标注收费属于违法行为吗
  • 网站开发工程师php岗位职责企业网站案例展示
  • 青岛网站营销推广网站工作室设计