关于Pandas中的部分索引技巧
来源:互联网 发布:天下三男鬼墨捏脸数据 编辑:程序博客网 时间:2024/06/10 02:04
关于Pandas中的部分索引技巧
import pandas as pdimport numpy as np
obj=np.arange(9).reshape(3,3)
obj
array([[0, 1, 2], [3, 4, 5], [6, 7, 8]])
Series:
ser1=pd.Series(range(9))
ser1ser1.index=['a','b','c','d','e','f','g','h','i']ser1
a 0b 1c 2d 3e 4f 5g 6h 7i 8dtype: int64
obj2=np.arange(9).reshape(3,3)
DataFrame:
df1=pd.DataFrame(obj2,columns=range(3),index=['a','b','c'])
# .ioc与.iloc 都用于行索引(index) # .loc 标签索引# .iloc 位置(index)索引df1.iloc[2]
0 61 72 8Name: c, dtype: int32
df1.loc['b']
0 31 42 5Name: b, dtype: int32
df1.ix[1]
C:\Python\lib\site-packages\ipykernel_launcher.py:1: DeprecationWarning: .ix is deprecated. Please use.loc for label based indexing or.iloc for positional indexingSee the documentation here:http://pandas.pydata.org/pandas-docs/stable/indexing.html#ix-indexer-is-deprecated """Entry point for launching an IPython kernel.0 31 42 5Name: b, dtype: int32
阅读全文
0 0
- 关于Pandas中的部分索引技巧
- Pandas 中的四中索引方式详解
- 关于索引的使用技巧
- pandas遍历文件夹提取单个文件中的部分列集合
- pandas数据索引变换
- pandas索引对象
- Pandas MultiIndex(多重索引)
- Pandas 列索引操作
- pandas层次化索引
- pandas索引和选择
- pandas索引和选择
- Pandas-索引index
- Pandas索引方法介绍
- pandas通过ix 索引
- pandas层次化索引
- python pandas 序列索引
- python pandas 位置索引
- pandas索引与计算
- CodeForces gym101173 Bipartite Blanket
- leetcode 494. Target Sum 深度优先遍历DFS + DP动态规划
- Elasticsearch6.x之Logstash安装-yellowcong
- 彻底理解Linux的各种终端类型以及概念
- SpringMVC返回json数据
- 关于Pandas中的部分索引技巧
- iOS中的常见事件及其响应
- STl训练每个题的总结
- 数据结构实验之查找二:平衡二叉树
- docker 4 安装
- 线程的等待/唤醒机制实例演示
- java微信企业付款
- linux基本操作---shell编程、if、case基本操作
- 深度学习