当前位置:网站首页>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]
这两个具体到行号和列号,直接定位
边栏推荐
- Use of Arduino wire Library
- Classic literature reading -- deformable Detr
- Hydration failed because the initial UI does not match what was rendered on the server.问题原因之一
- Data science [9]: SVD (2)
- Summary of WLAN related knowledge points
- Contest3147 - game 38 of 2021 Freshmen's personal training match_ G: Flower bed
- Three suggestions for all students who have graduated and will graduate
- Learn about various joins in SQL and their differences
- Contest3147 - game 38 of 2021 Freshmen's personal training match_ 1: Maximum palindromes
- VRRP之监视上行链路
猜你喜欢

IPv6 experiment and summary

华为MindSpore开源实习机试题

Invalid operation: Load into table ‘sources_orderdata‘ failed. Check ‘stl_load_errors‘ system table

Redis——热点key问题

栈(线性结构)

深入学习JVM底层(三):垃圾回收器与内存分配策略

Amazon AWS data Lake Work Pit 1

Classic literature reading -- deformable Detr

VRRP之监视上行链路

Browser principle mind map
随机推荐
深入学习JVM底层(四):类文件结构
I/o multiplexing & event driven yyds dry inventory
程序员的自我修养—找工作反思篇
From design delivery to development, easy and efficient!
MySQL的10大经典错误
底层机制Mvcc
Is there a really free applet?
sudo提权
分布式事务 :可靠消息最终一致性方案
Contest3147 - game 38 of 2021 Freshmen's personal training match_ E: Listen to songs and know music
LeetCode 90. 子集 II
浅谈三点建议为所有已经毕业和终将毕业的同学
State machine in BGP
LeetCode 39. Combined sum
Talking about MySQL database
Sentinel 阿里开源流量防护组件
【每日一题】写一个函数,判断一个字符串是否为另外一个字符串旋转之后的字符串。
LeetCode 78. 子集
Replace Django database with MySQL (attributeerror: 'STR' object has no attribute 'decode')
Network related knowledge (Hardware Engineer)