当前位置:网站首页>DeprecationWarning: .ix is deprecated. Please use.loc for label based indexing or.iloc for positi
DeprecationWarning: .ix is deprecated. Please use.loc for label based indexing or.iloc for positi
2022-07-02 06:21:00 【zb0567】
抄过来的例子 自我体会
import pandas as pd
data = [[1,2,3],[4,5,6],[7,8,9]]
rows = ['row1','row2','row3']#行标签
columns = ['col1','col2','col3']#列标签
df = pd.DataFrame(data, index=rows, columns=columns)
print df
col1 col2 col3
row1 1 2 3
row2 4 5 6
row3 7 8 9
print df.loc['row1']
col1 1
col2 2
col3 3
Name: row1, dtype: int64
print df.iloc[0]
col1 1
col2 2
col3 3
Name: row1, dtype: int64
print df.ix[0] print df.ix['row1']
col1 1
col2 2
col3 3
Name: row1, dtype: int64
说明以上三种是等同的,
但是loc和iloc更具体,稍不注意就会语法出错
ix更通用性,估计容易出现误差
print df.ix['row1',‘col1’] print df.ix['row1',0]
这两个具体到行号和列号,直接定位
边栏推荐
- CUDA中的存储空间修饰符
- Is there a really free applet?
- 数据科学【八】:SVD(一)
- 深入学习JVM底层(三):垃圾回收器与内存分配策略
- 实习生跑路留了一个大坑,搞出2个线上问题,我被坑惨了
- LeetCode 78. 子集
- Sentinel规则持久化到Nacos
- WLAN相关知识点总结
- Linked list (linear structure)
- Compte à rebours de 3 jours pour l'inscription à l'accélérateur de démarrage Google Sea, Guide de démarrage collecté à l'avance!
猜你喜欢
随机推荐
Google Go to sea entrepreneurship accelerator registration countdown 3 days, entrepreneurs pass through the guide in advance collection!
一起学习SQL中各种join以及它们的区别
Mech 3002 explanation
介绍两款代码自动生成器,帮助提升工作效率
State machine in BGP
Don't use the new WP collection. Don't use WordPress collection without update
利用NVIDIA GPU将Minecraft场景渲染成真实场景
栈(线性结构)
LeetCode 27. Removing Elements
递归(迷宫问题、8皇后问题)
链表(线性结构)
数据科学【九】:SVD(二)
Data playback partner rviz+plotjuggler
深入学习JVM底层(二):HotSpot虚拟机对象
IDEA公布全新默认UI,太清爽了(内含申请链接)
Contest3145 - the 37th game of 2021 freshman individual training match_ H: Eat fish
MySQL的10大经典错误
Contest3147 - game 38 of 2021 Freshmen's personal training match_ E: Listen to songs and know music
LeetCode 78. 子集
Linked list (linear structure)