当前位置:网站首页>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 9
print df.loc['row1']
col1 1
col2 2
col3 3
Name: row1, dtype: int64
print df.iloc[0]
col1 1
col2 2
col3 3
Name: row1, dtype: int64
print df.ix[0] print df.ix['row1']
col1 1
col2 2
col3 3
Name: row1, dtype: int64
It 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
边栏推荐
- Redis - big key problem
- Fe - wechat applet - Bluetooth ble development research and use
- Eggjs -typeorm 之 TreeEntity 实战
- MySql索引
- selenium+msedgedriver+edge浏览器安装驱动的坑
- Selenium memo: selenium\webdriver\remote\remote_ connection. Py:374: resourcewarning: unclosed < XXXX > solution
- 分布式事务 :可靠消息最终一致性方案
- 华为MindSpore开源实习机试题
- CTF three count
- Redis - cluster data distribution algorithm & hash slot
猜你喜欢
Solution to the black screen of win computer screenshot
Latex在VSCODE中编译中文,使用中文路径问题解决
Latest CUDA environment configuration (win10 + CUDA 11.6 + vs2019)
Latex参考文献引用失败 报错 LaTeX Warning: Citation “*****” on page y undefined on input line *
Win10:添加或者删除开机启动项,在开机启动项中添加在用户自定义的启动文件
CTF three count
一口气说出 6 种实现延时消息的方案
Utilisation de la carte et de foreach dans JS
Latex error: the font size command \normalsize is not defined problem solved
Redis - grande question clé
随机推荐
Latex warning: citation "*****" on page y undefined on input line*
web自动化切换窗口时报错“list“ object is not callable
Redis - big key problem
Name six schemes to realize delayed messages at one go
IDEA公布全新默认UI,太清爽了(内含申请链接)
由于不正常断电导致的unexpected inconsistency;RUN fsck MANUALLY问题已解决
CTF three count
[literature reading and thought notes 13] unprocessing images for learned raw denoising
virtualenv和pipenv安装
No process runs when querying GPU, but the video memory is occupied
由於不正常斷電導致的unexpected inconsistency;RUN fsck MANUALLY問題已解决
Latex error: the font size command \normalsize is not defined problem solved
js中map和forEach的用法
selenium备忘录:selenium\webdriver\remote\remote_connection.py:374: ResourceWarning: unclosed<xxxx>解决办法
Dynamic global memory allocation and operation in CUDA
Pytest (3) parameterize
Blog directory of zzq -- updated on 20210601
pytest(1) 用例收集规则
How to try catch statements that return promise objects in JS
代码技巧——Controller参数注解@RequestParam