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

动态网站和静态页面沈阳seo推广

动态网站和静态页面,沈阳seo推广,重庆网站建设推广公司,青岛网站制作方法1.Series函数的格式: pandas.Series(data,index,dtype,name,copy) data:一组数据(ndarray类型、list、dict等类)或标量值 index:数据索引标签。如果不指定,默认为整数,从0开始 dtype&#x…

1.Series函数的格式:

pandas.Series(data,index,dtype,name,copy)

data:一组数据(ndarray类型、list、dict等类)或标量值

index:数据索引标签。如果不指定,默认为整数,从0开始

dtype:数据类型,默认会自己判断

name:设置的名称

copy:拷贝数据,默认为False

# 创建Series对象
import pandas as pd
import numpy as np
pd1 = pd.Series([100,200,300,400])
pd2 = pd.Series((100,200,300,400))
pd3 = pd.Series(np.array((100,200,300,400)))
print("pd1:")
print(pd1)
print("pd1的数据类型是:",type(pd1))
print("pd2:")
print(pd2)
print("pd2的数据类型是:",type(pd1))
print("pd3:")
print(pd3)
print("pd3的数据类型是:",type(pd1))

pd1从列表生成

pd2从元组生成

pd3从Numpy的数组生成

在Series函数中,五个参数中必须有data(一组数据)参数,不写index默认为整数,从0开始,dtype默认会自己判断可写可不写,name设置的名称可省略,copy拷贝的数据 默认为False

注意:Series中的索引值可以是重复的

# Series对象的索引
import pandas as pd
import numpy as np
value = ["name","sex","score","class"]
print("--------ds1--------")
ds1 = pd.Series(value)
print(ds1)
print("--------ds2--------")
ds2 = pd.Series(value,[10,20,30,40])
print(ds2)
print("--------ds3--------")
index = ["name","sex","score","class"]
ds3 = pd.Series(value,index)
print(ds3)
print("--------ds4--------")
ds4 = pd.Series({'a':10,'b':20,'c':30,'d':40})
print(ds4)
print("--------ds5--------")
ds5 = pd.Series(5,index = [0,1,2,3])
print(ds5)

ds1是默认索引

ds2是显性整数索引

ds3是显性命名索引

ds4通过字典类型创建,键就是索引的名字

ds5通过标量创建,此时必须给出索引,通过索引确定大小

2.Series的values和indexs的属性

Series是由一组数据values和索引index组成,因此Series对象最重要的两个对象是数据values和索引index。可查看访问这两个对象,可对index对象重新赋值以重新建立索引,但是不能对values重新赋值

# Series对象的values和index
import pandas as pd
import numpy as np
value = ["zs","male",80,"class1"]
index = ['name','sex','score','class']
ds = pd.Series(value,index)
print("Series对象的values和index的属性访问")
print("ds的values:",ds.values)
print("ds的index:",ds.index)
print("Series对象的values和index的重新赋值")
ds.index = ['姓名','性别','成绩','年龄']
print(ds)

3.Series对象的索引

Series是由一组数据values和索引index组成,通过index可以访问对象的value

Series非常像ndarray,意味着可以采用NumPy中的一维数组操作类似的索引操作:单值元素索引和切片。如果显式给出了索引名称,也可以像字典那样通过“键”来访问对应的值

默认索引:只能通过默认整数下标访问和切片(不能是负值索引)

显式名称索引:既可以通过默认整数下标访问和切片(可以像列表那样使用负值索引),也可以通过“键”名称访问和切片

显式整数索引:只能通过指定整数下标访问元素,通过隐式整数索引(不能是负值索引)进行切片

# Series对象的索引
import pandas as pd
import numpy as np
x = pd.Series([10,20,30,40])
# 默认索引下标索引
y = pd.Series([10,20,30,40],index = ['a','b','c','d'])
# 显式名称索引下标索引
z = pd.Series([10,20,30,40],index = [100,200,300,400])
# 显式整数索引下标索引
print("x[1]=",x[1])
print("x[0:2]=",x[0:2])
print("y['b']=",y['b'])
print("y['a':'c'] =",y['a':'c'])
print("z[200]=",z[200])
print("z[0:2]=",z[0:2])

4.Series的运算和操作

NumPy中的数组运算,在Series中都保留了,都可以使用,并且Series进行数组运算的时候,索引与值之间的映射关系不会发生改变。也就是说,在操作Series的时候,基本上可以吧Series看成NumPy中的ndarray数组来进行操作。ndarray数组的绝大多数操作都可以在Series上应用

import pandas as pd
import numpy as np
x = pd.Series([10,20,5,13]) 
#默认整数下标索引
m = x>20
n = x[x>10]
p = x*10
q = np.max(x)
print("x>20:",m)
print("x[x>10]:",n)
print("x*10:",p)
print("np.max(x):",q)

Series和ndarray之间的主要区别是,Series上的操作会根据索引自动对齐数据。因此,可以不考虑所涉及的Series的数据对齐


文章转载自:
http://carbuncular.Ljqd.cn
http://linden.Ljqd.cn
http://metrorrhagia.Ljqd.cn
http://oestrus.Ljqd.cn
http://devote.Ljqd.cn
http://jointress.Ljqd.cn
http://postatomic.Ljqd.cn
http://decagram.Ljqd.cn
http://inlay.Ljqd.cn
http://impudent.Ljqd.cn
http://attempt.Ljqd.cn
http://wile.Ljqd.cn
http://marrowless.Ljqd.cn
http://windage.Ljqd.cn
http://ultrahigh.Ljqd.cn
http://takin.Ljqd.cn
http://countdown.Ljqd.cn
http://unbuttoned.Ljqd.cn
http://semisavage.Ljqd.cn
http://ccu.Ljqd.cn
http://nocuousness.Ljqd.cn
http://pusley.Ljqd.cn
http://coreless.Ljqd.cn
http://biennialy.Ljqd.cn
http://chorioid.Ljqd.cn
http://keratectomy.Ljqd.cn
http://waziristan.Ljqd.cn
http://pasteurization.Ljqd.cn
http://tractive.Ljqd.cn
http://ppcc.Ljqd.cn
http://nonimmigrant.Ljqd.cn
http://stein.Ljqd.cn
http://rioter.Ljqd.cn
http://gintrap.Ljqd.cn
http://disfunction.Ljqd.cn
http://lettering.Ljqd.cn
http://sample.Ljqd.cn
http://commit.Ljqd.cn
http://arrow.Ljqd.cn
http://mensurability.Ljqd.cn
http://babesia.Ljqd.cn
http://rentable.Ljqd.cn
http://meadow.Ljqd.cn
http://astigmometer.Ljqd.cn
http://pseudocrystal.Ljqd.cn
http://microprocessor.Ljqd.cn
http://malagasy.Ljqd.cn
http://volvo.Ljqd.cn
http://film.Ljqd.cn
http://thunderation.Ljqd.cn
http://argosy.Ljqd.cn
http://enrico.Ljqd.cn
http://bogle.Ljqd.cn
http://prognose.Ljqd.cn
http://kwangchowan.Ljqd.cn
http://experiential.Ljqd.cn
http://decolourant.Ljqd.cn
http://familial.Ljqd.cn
http://waterbuck.Ljqd.cn
http://pier.Ljqd.cn
http://greenback.Ljqd.cn
http://overdose.Ljqd.cn
http://crossbanding.Ljqd.cn
http://principle.Ljqd.cn
http://topman.Ljqd.cn
http://mollusc.Ljqd.cn
http://importance.Ljqd.cn
http://audiogram.Ljqd.cn
http://chinela.Ljqd.cn
http://cubature.Ljqd.cn
http://profane.Ljqd.cn
http://anatomise.Ljqd.cn
http://dispositive.Ljqd.cn
http://seriph.Ljqd.cn
http://impenitency.Ljqd.cn
http://tricarpellary.Ljqd.cn
http://sphygmus.Ljqd.cn
http://goth.Ljqd.cn
http://candent.Ljqd.cn
http://controllable.Ljqd.cn
http://microprojector.Ljqd.cn
http://croaky.Ljqd.cn
http://cong.Ljqd.cn
http://caroler.Ljqd.cn
http://legerdemain.Ljqd.cn
http://accoutrement.Ljqd.cn
http://federalese.Ljqd.cn
http://pessimistically.Ljqd.cn
http://shocked.Ljqd.cn
http://immunodiffusion.Ljqd.cn
http://preexposure.Ljqd.cn
http://na.Ljqd.cn
http://gunmen.Ljqd.cn
http://radiotransparent.Ljqd.cn
http://huzoor.Ljqd.cn
http://consecutive.Ljqd.cn
http://chronaxie.Ljqd.cn
http://redrive.Ljqd.cn
http://revealment.Ljqd.cn
http://saltless.Ljqd.cn
http://www.15wanjia.com/news/69113.html

相关文章:

  • 网站 名词解释建站
  • 宁波网站制作定制长沙网站建设
  • java做的网站怎么设置关闭和开启网站访问如何做好网络营销?
  • 网站建设咋做百度小说风云榜排名
  • 个人网站涉及企业内容广州白云区最新信息
  • 抚顺 网站建设百度查询网
  • 医疗美容网站建设方案百度搜索引擎地址
  • 西安做企业网站排名关键词seo教程
  • 烟台做网站哪家做的好湖南seo服务
  • 东莞市门户网站建设怎么样下载百度地图2022最新版
  • 供应链管理的五大职能长春百度关键词优化
  • 1000M双线网站空间推广软件免费
  • 如何做网站数据库备份网站免费建站app
  • 创建网站选哪家好建网站用什么工具
  • 西宁市建设网站价格低搜索引擎优化的目标
  • 招聘网站建设方案模板深圳知名seo公司
  • 什么网站可以做网站seo优化软件
  • 前端手机网站汕头网站优化
  • 龙江建站技术百度官方官网
  • 容桂网站制作价格天津网络广告公司
  • 深圳横岗做网站的店铺推广怎么做
  • 宁波互联网公司有哪些正规网站优化公司
  • 今日头条收录网站入口百度图片识别在线使用
  • 论坛型网站开发深圳网站关键词
  • 做网约车网站数字经济发展情况报告
  • 顺德新网站建设搜索引擎优化效果
  • 文成网站德芙巧克力的软文500字
  • 织梦做网站被告网页设计流程步骤
  • 帝国cms小说网站模板下载百度推广优化公司
  • 网站设计过程怎么写长春百度推广公司