【发布时间】:2018-03-05 03:30:35
【问题描述】:
我有一个如下的数据框。
df = pd.DataFrame({'Title': ['x','y','z','aa'], 'Result': [2, 5, 11, 16]})
我想返回一个只包含超过 10 个的文本字符串。
我想要的结果示例如下
From the results in df, the below returned greater than 10:
z
aa
我已经尝试了以下方法,但它没有给出我正在寻找的输出。它在同一行给出了一个数组。不像上面那样。
df2 = df[df['Result']>= 10]
df3 = df2['Title'].values
print ('From the results in df, the below returned greater than 10:\n\t%s' (df3))
【问题讨论】: