pandas-at, iat function

For DataFrame data, use at or iat, and specify the row position and column position

#!/usr/bin/env python
# coding: utf-8

# # 第一课 数据分析工具Pandas高阶
# ## 第三节 标量的快速获取与赋值at与iat函数

# In[1]:


import pandas as pd
import numpy as np


# * 读取文件

# In[2]:
raw_df1 = pd.read_csv('./datasets/2016_happiness.csv')
# In[3]:
raw_df2 = raw_df1.copy()
# In[4]:
raw_df2 
# * loc与at数据获取对比
%%timeit -n 100000
raw_df1.iloc[0, 0]
%%timeit -n 100000
raw_df2.iat[0, 0]

Guess you like

Origin blog.csdn.net/lildn/article/details/114681701