当前位置:网站首页>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]
这两个具体到行号和列号,直接定位
边栏推荐
猜你喜欢
随机推荐
ROS create workspace
CUDA中的异步数据拷贝
Web components series (VIII) -- custom component style settings
LeetCode 77. combination
Contest3147 - game 38 of 2021 Freshmen's personal training match_ F: Polyhedral dice
【程序员的自我修养]—找工作反思篇二
CUDA中的函数执行空间说明符
Redis——大Key问题
VLAN experiment of switching technology
Does the assignment of Boolean types such as tag attribute disabled selected checked not take effect?
LeetCode 90. Subset II
CUDA中的动态全局内存分配和操作
sudo提权
队列(线性结构)
Codeforces Round #797 (Div. 3) A—E
最新CUDA环境配置(Win10 + CUDA 11.6 + VS2019)
Detailed explanation of BGP message
Redis——Cluster数据分布算法&哈希槽
递归(迷宫问题、8皇后问题)
实现strStr() II








