DataFrame在某一列中取符合条件的值
作者:互联网
DataFrame在某一列中取符合条件的值,实例为在时间列中取出小于10的值。
import numpy as np
import pandas as pd
df = pd.read_csv(r'C:/Users/hanhan/PycharmProjects/pythonProject/data.csv',encoding = 'gbk')
t = np.array(df['时间'])
print('初始值的t=',t)
t = np.array(df[df['时间']<10]['时间'])
print('筛选后的t=',t)
标签:df,DataFrame,中取,一列,pd,np,array 来源: https://blog.csdn.net/Han_torch/article/details/121945530