在Python中使用Pandas从CSV文件读取特定数据

时间:2018-11-19 18:30:52

标签: python pandas

我有一个.CSV文件,其中包含许多列。我需要找到加利福尼亚帕萨迪纳的三个最高价值。相关列为“提供者城市”,“提供者州”和“平均医疗保险付款”。因此,我需要找到加利福尼亚州帕萨迪纳(Pasadena)最高的3种平均医疗保险付款。

到目前为止,我的代码如下:

print('The three largest numbers for Pasadena, CA are', nlargest(3, df['Average Medicare Payments']))

我只能在“平均医疗保险支付”列的所有值中找到三个最高值,而不是仅将其过滤到加利福尼亚州的帕萨迪纳。有什么想法吗?

1 个答案:

答案 0 :(得分:0)

var tooltip = d3.select(TARGET_ELEMENT).append("div")
.attr("class", "tooltip")
.style("opacity", 50)
.attr("style", "position: absolute; pointer-events: none; background: lightsteelblue; width:200px; height:28px;");
相关问题