按一定条件筛选df1,返回结果中df1的索引取df2的数据

每日一题:
df1,df2已知,按一定条件筛选df1,返回结果中df1的索引取df2的数据?

df1 = pd.DataFrame(np.random.random(50).reshape(25,2))
按一定条件筛选df1,返回结果中df1的索引取df2的数据
df2 = pd.DataFrame(np.random.randint(100,size=50).reshape(25,2))
按一定条件筛选df1,返回结果中df1的索引取df2的数据
解决:
df2.loc[df1[df1[0]>0].index] 即可

知识点:
**1.random.randint(low,high,size)生成整数,至少要2个参数才能生成随机整数序列,单独使用size会报错;

2.按索引取数:df.loc([1,2])**。