当前位置:网站首页>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]
这两个具体到行号和列号,直接定位
边栏推荐
- Sentinel 阿里开源流量防护组件
- Contest3147 - game 38 of 2021 Freshmen's personal training match_ 1: Maximum palindromes
- Golang -- map capacity expansion mechanism (including source code)
- Classic literature reading -- deformable Detr
- Hydration failed because the initial UI does not match what was rendered on the server.问题原因之一
- Community theory | kotlin flow's principle and design philosophy
- 【每日一题】—华为机试01
- LeetCode 27. 移除元素
- 找到页面当前元素z-index最高的数值
- MySQL的10大經典錯誤
猜你喜欢

ROS create workspace

Linear DP (split)

Reading classic literature -- Suma++

From design delivery to development, easy and efficient!

Redis——Cluster数据分布算法&哈希槽

找到页面当前元素z-index最高的数值

Sentinel 阿里开源流量防护组件

In depth understanding of JUC concurrency (II) concurrency theory

Singleton mode compilation

深入学习JVM底层(二):HotSpot虚拟机对象
随机推荐
Browser principle mind map
CUDA中的Warp matrix functions
LeetCode 283. Move zero
Learn about various joins in SQL and their differences
线性dp(拆分篇)
It is said that Kwai will pay for the Tiktok super fast version of the video? How can you miss this opportunity to collect wool?
队列(线性结构)
Reading classic literature -- Suma++
实现strStr() II
Cglib agent - Code enhancement test
When requesting resttemplate, set the request header, request parameters, and request body.
Top 10 classic MySQL errors
Redis——大Key問題
Common means of modeling: combination
Monitoring uplink of VRRP
Amazon AWS data Lake Work Pit 1
Step by step | help you easily submit Google play data security form
华为MindSpore开源实习机试题
ROS create workspace
锐捷EBGP 配置案例