简体   繁体   English

当 x 大于 y 时,我需要得到 x 的值

[英]i need to get the value of x when x greater than y

df = pd.DataFrame(json_response["data"]["candles"], columns=['Date', 'Open', 'High', 'Low', 'Close', 'Volume'])

x=400
y=300
if(x > y):
print(x)

Here x is one column in csv with values and y another column if the first column x > y then print value of x where the column value associated这里x是CSV一个柱值和y另一列如果第一列x > y然后打印的值x ,其中该列值相关联

Just select the rows meeting your criteria, then print the column you're interested in:只需选择符合您条件的行,然后打印您感兴趣的列:

# result is series
print(df(df["x"]>df["y"])["x"])

# result is array of integers
for result in df(df["x"]>df["y"])["x"].values:
    print(result)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如果 x 或 y 大于/小于 N,则过滤 x,y 坐标 - Filter x,y coordinates if x or y greater/less than N 如果值大于 x,则从列表中选择所有值,直到值大于 y。 将所有其他值设为 0 - If value is greater than x select all values from list until value is greater than y. Make all other values 0 x 列中出现的值大于 y 列中的单个值 - Python - Occurrences of value in column x greater than single value in column y - Python 在字典上大于X且小于Y的所有字符串 - All the strings lexicographically greater than X and smaller than Y 计算一列中大于x但小于y的元素数 - Count number of elements in a column greater than x but smaller than y ValueError:x 和 y 不能大于 2-D,但具有 (2, 1, 1) 和 (2,) 形状 - ValueError: x and y can be no greater than 2-D, but have shapes (2, 1, 1) and (2,) Pandas - 如果列中的 X 浮点数大于 Y,则找出 X 和 Y 之间的差值并乘以 0.25 - Pandas - if X float in column is greater than Y, find difference between X and Y and multiply by .25 筛选 pandas dataframe 行,其中具有列 A 和值 X 的特定行具有列 B,其值 Y 大于参数 Z - Filter pandas dataframe rows where a specific row with column A and value X has column B with value Y greater than a parameter Z 如何为 X 的每个值获得 Y 的最小值? - How can I get min value of Y for each value of X? 如何创建优化,其中对于 x 的值,我得到 y 使得 y 为最小值,x 为最大值 - How to create a optimization where for value of x I get y such that y is minimum and x is maximum
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM