当前位置:网站首页>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 9print df.loc['row1']
col1 1
col2 2
col3 3
Name: row1, dtype: int64print df.iloc[0]
col1 1
col2 2
col3 3
Name: row1, dtype: int64print 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]
这两个具体到行号和列号,直接定位
边栏推荐
- LeetCode 283. Move zero
- Sentinel 阿里开源流量防护组件
- 阿里云MFA绑定Chrome浏览器
- Sentinel规则持久化到Nacos
- Find the highest value of the current element Z-index of the page
- Contest3147 - game 38 of 2021 Freshmen's personal training match_ A: chicken
- RestTemplate请求时设置请求头,请求参数,请求体。
- 浅谈三点建议为所有已经毕业和终将毕业的同学
- TensorRT的数据格式定义详解
- TensorRT的命令行程序
猜你喜欢

LeetCode 90. 子集 II

Current situation analysis of Devops and noops

Contest3147 - game 38 of 2021 Freshmen's personal training match_ G: Flower bed

Zhuanzhuanben - LAN construction - Notes

Browser principle mind map

From design delivery to development, easy and efficient!

Replace Django database with MySQL (attributeerror: 'STR' object has no attribute 'decode')

线性dp(拆分篇)

数据科学【八】:SVD(一)
![Data science [9]: SVD (2)](/img/2c/f1a8c3ff34ff3f3cc6e26157a32bfd.png)
Data science [9]: SVD (2)
随机推荐
Singleton mode compilation
ROS create workspace
Hydration failed because the initial UI does not match what was rendered on the server.问题原因之一
CUDA中的Warp matrix functions
Redis——Cluster数据分布算法&哈希槽
Common means of modeling: combination
CUDA中的线程层次
穀歌出海創業加速器報名倒計時 3 天,創業人闖關指南提前收藏!
The real definition of open source software
LeetCode 77. combination
From design delivery to development, easy and efficient!
广告业务Bug复盘总结
LeetCode 283. Move zero
深入学习JVM底层(三):垃圾回收器与内存分配策略
数据科学【八】:SVD(一)
Golang--map扩容机制(含源码)
ShardingSphere-JDBC篇
AttributeError: ‘str‘ object has no attribute ‘decode‘
栈(线性结构)
Support new and old imperial CMS collection and warehousing tutorials