有行索引和列索引

df=DataFrame(np.arange(16).reshape((4,4)),index=['a','b','c','d'],columns=['one','two','three','four'])
df
Out[14]: one  two  three  four
a    0    1      2     3
b    4    5      6     7
c    8    9     10    11
d   12   13     14    15
po=df.loc[['a','b'],:] 
po
Out[16]: one  two  three  four
a    0    1      2     3
b    4    5      6     7

默认的索引

dd=DataFrame(np.arange(81).reshape((9,9)))dd
Out[20]: 0   1   2   3   4   5   6   7   8
0   0   1   2   3   4   5   6   7   8
1   9  10  11  12  13  14  15  16  17
2  18  19  20  21  22  23  24  25  26
3  27  28  29  30  31  32  33  34  35
4  36  37  38  39  40  41  42  43  44
5  45  46  47  48  49  50  51  52  53
6  54  55  56  57  58  59  60  61  62
7  63  64  65  66  67  68  69  70  71
8  72  73  74  75  76  77  78  79  80
pp=dd.loc[[1,5,7],:]pp
Out[25]: 0   1   2   3   4   5   6   7   8
1   9  10  11  12  13  14  15  16  17
5  45  46  47  48  49  50  51  52  53
7  63  64  65  66  67  68  69  70  71

如何在DataFrame索引某一行相关推荐

  1. 如何在 Pandas DataFrame 中插入一行

    您可以使用以下基本语法将行插入到 Pandas DataFrame 中的特定位置: import pandas as pd import numpy as np#insert row with val ...

  2. dataframe索引筛选_筛选的索引:性能分析和隐藏成本

    dataframe索引筛选 介绍 (Introduction) Filtered indexes are well documented, as they have been around in SQ ...

  3. 通过整数索引选择一行熊猫系列/数据框

    本文翻译自:Selecting a row of pandas series/dataframe by integer index I am curious as to why df[2] is no ...

  4. python中Pandas之DataFrame索引、选取数据

    目录 1.索引是什么 1.1 认识索引 1.2 自定义索引 2. 索引的简单使用 2.1 列索引 2.1.2 使用loc和iloc 2.2 行索引 2.2.1 使用[ : ] 2.2.2 使用.loc ...

  5. python dataframe增加一行_python - 在pandas.DataFrame中添加一行

    python - 在pandas.DataFrame中添加一行 据我所知,pandas旨在加载完全填充的DataFrame,但我需要创建一个空的DataFrame,然后逐个添加行.做这个的最好方式是什 ...

  6. pandas中dataframe索引排序实战:pandas中dataframe索引降序排序、pandas中dataframe索引升序排序

    pandas中dataframe索引排序实战:pandas中dataframe索引降序排序.pandas中dataframe索引升序排序 目录

  7. python3-pandas DataFrame 索引、bool索引、pandas 字符串方法

    1.DataFrame 索引 1.1 普通索引取值 pandas 取行或者列的注意点: 方括号写数组,表示取行,对行进行操作 方括号写字符串,表示取列,对列进行操作 import pandas as ...

  8. Pandas DataFrame索引和列属性

    Pandas DataFrame index and columns attributes allow us to get the rows and columns label values. Pan ...

  9. 怎么在html中加横条,如何在HTML中插入一行?html横线标签hr全新讲解

    对于刚刚入门的新手不知道如何在HTML中插入一行?那么接下来我们认识一下html横线标签hr. 一:html横线标签hr属性 标签主要是在html中创建水平线,hr是单标签,是没有结束标签的,而且所有 ...

最新文章

  1. Installation error: INSTALL_FAILED_INSUFFICIENT_STORAGE
  2. k8s nodeport无法访问_k8s学习之service详解
  3. iOS开发UI中懒加载的使用方法
  4. php如何做熔断降级,spring cloud 如何实现服务熔断服务降级
  5. 4. 分类的线性模型
  6. react 引用本地js_从零配置webpack 4+react脚手架(二)
  7. 简单的策略模式Strategy演示
  8. 简单3步成功给Mac安装指定Python版本和指定库版本并且随意切换版本,非常简单,不行拿砖砸我
  9. iservice封装有哪些方法_对WebService的一些封装技巧总结
  10. Python3 Socket和SocketServer 网络编程
  11. 2015/08/24
  12. ASP.NET MVC实现网站验证码功能
  13. hdoj 1071 The Area 求面积
  14. mysql 能用compute_SQL compute by 的使用
  15. 用C语言开发一个BT下载软件(一) ------ BitTorrent协议 -2
  16. DynDNS免费动态域名解析
  17. Unity-URP-基于模板的延迟渲染
  18. Spark 推测执行 /spark.speculation=true /spark.speculation.quantile=0.75/spark.speculation.multiplier=1.5
  19. Stateful Firewall和SPI(stateful packet inspection) Firewall介绍
  20. echarts 折线图高于目标显示绿色低于目标显示红色

热门文章

  1. 考前自学系列·计算机组成原理·补码定点加减运算和溢出判断,浮点数的加减运算,原码的乘法
  2. UIAppearanceContainer 利器
  3. PHP自动加载类的实例
  4. android 从零单排 第一期 按键显示helloworld
  5. SQL中declare申明变量
  6. 集成信息医院需要什么样的集成平台
  7. 策略模式的扩展——策略枚举
  8. 讲解Linux服务器被黑解决方法
  9. 实现线程栈初始化(RTT)
  10. 基于python的FFT演示程序