当前位置:网站首页>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
边栏推荐
- Win10桌面图标没有办法拖动(可以选中可以打开可以删除新建等操作但是不能拖动)
- Nodejs - Express middleware modification header: typeerror [err_invalid_char]: invalid character in header content
- Pytest (1) case collection rules
- Log (common log framework)
- Apt command reports certificate error certificate verification failed: the certificate is not trusted
- Redis - hot key issues
- Redis——大Key问题
- AWD learning
- Asynchronous data copy in CUDA
- Warp matrix functions in CUDA
猜你喜欢
随机推荐
ModuleNotFoundError: No module named ‘jieba. analyse‘; ‘ jieba‘ is not a package
Redis——Cluster数据分布算法&哈希槽
20201025 Visual Studio2019 QT5.14 信号和槽功能的使用
Linked list (linear structure)
Virtualenv and pipenv installation
Redis——热点key问题
Nodejs - Express middleware modification header: typeerror [err_invalid_char]: invalid character in header content
Flask migrate cannot detect db String() equal length change
Log (common log framework)
Cglib agent - Code enhancement test
2020-9-23 use of QT timer qtimer class.
Latex 编译报错 I found no \bibstyle & \bibdata & \citation command
apt命令报证书错误 Certificate verification failed: The certificate is NOT trusted
Win10桌面图标没有办法拖动(可以选中可以打开可以删除新建等操作但是不能拖动)
看完有用的blog
Kotlin - verify whether the time format is yyyy MM DD hh:mm:ss
日志 - 7 - 记录一次丢失文件(A4纸)的重大失误
The intern left a big hole when he ran away and made two online problems, which made me miserable
Uploading attachments using Win32 in Web Automation
Redis - cluster data distribution algorithm & hash slot








