当前位置:网站首页>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:42:00 【zb0567】
Copy the example Self experience
import pandas as pd
data = [[1,2,3],[4,5,6],[7,8,9]]
rows = ['row1','row2','row3']# Row labels
columns = ['col1','col2','col3']# Column labels
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: int64It shows that the above three are equivalent ,
however loc and iloc More specifically , If you don't pay attention to it, you will make grammatical mistakes
ix More general , Estimation is prone to error
print df.ix['row1',‘col1’] print df.ix['row1',0]
These two are specific to row number and column number , Direct positioning
边栏推荐
- [daily question 1] write a function to judge whether a string is the string after the rotation of another string.
- AtCoder Beginner Contest 253 F - Operations on a Matrix // 树状数组
- Tensorrt command line program
- The intern left a big hole when he ran away and made two online problems, which made me miserable
- 记录一次RDS故障排除--RDS容量徒增
- 提高用户体验 防御性编程
- Fe - use of weex development weex UI components and configuration use
- Linked list (linear structure)
- 如何调试微信内置浏览器应用(企业号、公众号、订阅号)
- Alibaba cloud MFA binding Chrome browser
猜你喜欢

Latex 编译报错 I found no \bibstyle & \bibdata & \citation command
![[literature reading and thought notes 13] unprocessing images for learned raw denoising](/img/a5/ed26a90b3edd75a37b2e5164f6b7d2.png)
[literature reading and thought notes 13] unprocessing images for learned raw denoising

Utilisation de la carte et de foreach dans JS

Apt command reports certificate error certificate verification failed: the certificate is not trusted

Name six schemes to realize delayed messages at one go

unittest.TextTestRunner不生成txt测试报告

ctf-web之练习赛

web自动中利用win32上传附件

Latex compilation error I found no \bibstyle &\bibdata &\citation command

VSCODE 安装LATEX环境,参数配置,常见问题解决
随机推荐
AtCoder Beginner Contest 253 F - Operations on a Matrix // 树状数组
Uploading attachments using Win32 in Web Automation
The intern left a big hole when he ran away and made two online problems, which made me miserable
Win电脑截图黑屏解决办法
Redis——大Key問題
Linux MySQL 5.6.51 community generic installation tutorial
Summary of advertisement business bug replay
Usage of map and foreach in JS
记录一次RDS故障排除--RDS容量徒增
Latest CUDA environment configuration (win10 + CUDA 11.6 + vs2019)
Find the highest value of the current element Z-index of the page
Thread hierarchy in CUDA
Redis - hot key issues
FE - weex 开发 之 使用 weex-ui 组件与配置使用
Function execution space specifier in CUDA
Flask migrate cannot detect db String() equal length change
[daily question 1] write a function to judge whether a string is the string after the rotation of another string.
Unexpected inconsistency caused by abnormal power failure; Run fsck manually problem resolved
Functions of tensorrt
广告业务Bug复盘总结