当前位置:网站首页>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]
这两个具体到行号和列号,直接定位
边栏推荐
- 数据科学【九】:SVD(二)
- CUDA中的Warp Shuffle
- 注解和反射详解以及运用
- In depth understanding of JUC concurrency (II) concurrency theory
- CUDA中的存储空间修饰符
- Data playback partner rviz+plotjuggler
- Contest3147 - game 38 of 2021 Freshmen's personal training match_ A: chicken
- 深入学习JVM底层(三):垃圾回收器与内存分配策略
- Hydration failed because the initial UI does not match what was rendered on the server. One of the reasons for the problem
- Classic literature reading -- deformable Detr
猜你喜欢

LeetCode 78. 子集

Community theory | kotlin flow's principle and design philosophy

Singleton mode compilation

New version of dedecms collection and release plug-in tutorial tool

实现strStr() II

The official zero foundation introduction jetpack compose Chinese course is coming!

华为MindSpore开源实习机试题

Summary of WLAN related knowledge points

穀歌出海創業加速器報名倒計時 3 天,創業人闖關指南提前收藏!

深入学习JVM底层(二):HotSpot虚拟机对象
随机推荐
The difference between session and cookies
Contest3145 - the 37th game of 2021 freshman individual training match_ H: Eat fish
BGP 路由优选规则和通告原则
LeetCode 39. Combined sum
Google play academy team PK competition, official start!
Redis---1.数据结构特点与操作
数据科学【九】:SVD(二)
LeetCode 40. 组合总和 II
Sentinel 阿里开源流量防护组件
Does the assignment of Boolean types such as tag attribute disabled selected checked not take effect?
广告业务Bug复盘总结
Bgp Routing preference Rules and notice Principles
Contest3147 - game 38 of 2021 Freshmen's personal training match_ A: chicken
Contest3147 - game 38 of 2021 Freshmen's personal training match_ E: Listen to songs and know music
Google Go to sea entrepreneurship accelerator registration countdown 3 days, entrepreneurs pass through the guide in advance collection!
Invalid operation: Load into table ‘sources_orderdata‘ failed. Check ‘stl_load_errors‘ system table
锐捷EBGP 配置案例
Find the highest value of the current element Z-index of the page
LeetCode 90. Subset II
Learn about various joins in SQL and their differences