min

Get column names for the N Max/Min values per row in Pandas

岁酱吖の 提交于 2021-02-05 07:29:28
问题 I am trying to get, for each individual row, the name of the column with the max/min value up to N-values. Given something like this: a b c d e 1.2 2 0.1 0.8 0.01 2.1 1.1 3.2 4.6 3.4 0.2 1.9 8.8 0.3 1.3 3.3 7.8 0.12 3.2 1.4 I can get the max with idxmax(axis=1) and so on the min with idxmin(axis=1) but this only works for the top-max and bottom-min, not generalizable for N-values. I want to get, if called with N=2: a b c d e Max1 Max2 Min1 Min2 1.2 2.0 0.1 0.8 0.1 b a c e 2.1 1.1 3.2 4.6 3.4

Get column names for the N Max/Min values per row in Pandas

佐手、 提交于 2021-02-05 07:28:28
问题 I am trying to get, for each individual row, the name of the column with the max/min value up to N-values. Given something like this: a b c d e 1.2 2 0.1 0.8 0.01 2.1 1.1 3.2 4.6 3.4 0.2 1.9 8.8 0.3 1.3 3.3 7.8 0.12 3.2 1.4 I can get the max with idxmax(axis=1) and so on the min with idxmin(axis=1) but this only works for the top-max and bottom-min, not generalizable for N-values. I want to get, if called with N=2: a b c d e Max1 Max2 Min1 Min2 1.2 2.0 0.1 0.8 0.1 b a c e 2.1 1.1 3.2 4.6 3.4

List of Tuples (string, float)with NaN How to get the min value?

Deadly 提交于 2021-01-27 06:45:48
问题 I have a list of List of Tuples (string, float) with float('nan') . How can i get the tuple with the smallest number? If I use min I always get the nan . [('GroundBasedMechWT', nan), ('GroundBasedCTL', nan), ('GroundBasedManualWT', nan), ('GroundBasedManualLog', nan), ('CableManualWTLog', 60.77), ('CableManualWT', 58.52), ('CableManualLog', 68.17), ('CableManualCTL', nan), ('HelicopterManualWT', 96.82), ('HelicopterManualCTL', nan)] 回答1: You could also try this: min(filter(lambda t: not math

List of Tuples (string, float)with NaN How to get the min value?

混江龙づ霸主 提交于 2021-01-27 06:42:51
问题 I have a list of List of Tuples (string, float) with float('nan') . How can i get the tuple with the smallest number? If I use min I always get the nan . [('GroundBasedMechWT', nan), ('GroundBasedCTL', nan), ('GroundBasedManualWT', nan), ('GroundBasedManualLog', nan), ('CableManualWTLog', 60.77), ('CableManualWT', 58.52), ('CableManualLog', 68.17), ('CableManualCTL', nan), ('HelicopterManualWT', 96.82), ('HelicopterManualCTL', nan)] 回答1: You could also try this: min(filter(lambda t: not math

Min() and Max() based on partition in sql server

蹲街弑〆低调 提交于 2020-12-12 10:16:45
问题 I want to use min & max function but on certain criteria. Create Table #Test (Id Int Identity(1,1), Category Varchar(100), DateTimeStamp DateTime) Insert into #Test (Category,DateTimeStamp) values ('c1','2019-08-13 01:00:13.503') Insert into #Test (Category,DateTimeStamp) values ('c1','2019-08-13 02:00:13.503') Insert into #Test (Category,DateTimeStamp) values ('c1','2019-08-13 03:00:13.503') Insert into #Test (Category,DateTimeStamp) values ('c1','2019-08-13 04:00:13.503') Insert into #Test