Questions tagged [rank]

Rank refers to the relative position, value, worth, complexity, power, level etc. of an object.

rank
Filter by
Sorted by
Tagged with
2 votes
1 answer
328 views

Pandas groupby then rank: correct syntax to specify order

I'd like to specify rank order in pandas. I know you can do it when you do: df.groupby([x, y]).rank(ascending=False) Question 1 How can I specify the ranking order (ascending=False) inside agg ...
-4 votes
0 answers
25 views

Excel RANK Function - Passing Cleaned Data [closed]

I'm running into an issue writing a custom function to rank golf scores and split points similar to how PGA purses are split if there's a tie. One scenario for our league is that a pair might not play,...
1 vote
2 answers
26 views

Youngest and oldest employee rank()

I have set up below that's working but I am trying to change it to use rank() and I'm running into various syntax errors. I was hoping someone could help me out. ALTER SESSION SET NLS_DATE_FORMAT = ...
0 votes
0 answers
7 views

Identifying Permutations Yielding a Specific Kendall Tau Correlation with an Original Series

I am currently engaged in a project that entails the analysis of ordinal data, focusing specifically on determining the rank correlation between various permutations of a dataset and an original ...
0 votes
1 answer
58 views

How to rank a date field?

My table looks like this: Project Date EO124 07-25-2023 E0124 08-01-2023 EO124 10-05-2023 EO124 10-12-2023 EO124 11-10-2023 EO124 11-17-2023 EO124 12-01-2023 In my table, there are multiple ...
1 vote
1 answer
32 views

DENSE-RANK to rank the department with most employees

I have a table called employees with follow column: Field Type NULL Key employee_id int NO PRI first_name varchar(20) YES last_name varchar(25) NO email varchar(100) NO phone_number varchar(20) ...
1 vote
0 answers
35 views

Applying rollify to calculate percentrank

I have the table Wide_DF similar to the below structure( more rows than below) DATE TICKER Total_Put 2021-01-03 A 23.4 2021-01-03 B 13.1 2021-01-03 C 34.6 The colum TICKER has 3 values A,B,C, i.e ...
2 votes
4 answers
4k views

Applying Ranks to every group in Pandas Groupby

Say I have a simple dataset (namely df1) like this: ID Name Max_FileID -------------------------------- 1 Dog 3 1 Dog 3 1 Dog 3 2 Bird ...
3 votes
2 answers
3k views

How to make pandas.DataFrame.rank to start from 0?

How to make pandas.DataFrame.rank(pct=True) to start from 0? For example, if I have 11 numbers in a column, rank will yield 0.0909, 0.1818, ..., 1.0000. I want it to yield 0.0000, 0.1000, ..., 1....
0 votes
2 answers
1k views

How to construct a rank array with numpy? (What is a rank array?)

In my python class, we are learning how to use Numpy, so we got an assignment about that. My question is this: What is a rank array and how can I construct that with using python? My instructor tried ...
334 votes
26 answers
741k views

ROW_NUMBER() in MySQL

Is there a nice way in MySQL to replicate the SQL Server function ROW_NUMBER()? For example: SELECT col1, col2, ROW_NUMBER() OVER (PARTITION BY col1, col2 ORDER BY col3 DESC) AS intRow ...
2 votes
3 answers
165 views

Creating RANK in Excel with conditions in Excel

I have a file I need to have ranked but need to ignore specified rows. Here is an example. A B C INCLUDE ORDER RANK ORDER 1 1 1 0 2 ...
2 votes
4 answers
1k views

Pick a record based on the value of one column being the greatest in Snowflake

Let's say I have a table structured like this Name Score Mike 40 Mike 79 Mike 49 And I wanted to return just the row that says Mike with the score of 79 and nothing else. The code I have been ...
1 vote
2 answers
69 views

Create an order column in a pandas dataframe based on one date column relative to another date column

I have an extract where I'm required to identify a certain type of surgery X seen in the Surg Type column. I need to retain medical appointments seen as distinct rows over a window/period of time, 3 ...
0 votes
0 answers
18 views

Power BI Dynamic Table Title based on individual account rank

I have created a series of monthly sales tables in Power BI using a DAX formula to rank an account as number 1 or number 20 based on total sales. Account name in my database is "National Account ...
0 votes
1 answer
57 views

issue with QUALIFY RANK

Trying to delete records using below query. DELETE FROM TABLE_1 WHERE NUMB IN ( SELECT NUMB FROM TABLE_2 WHERE FLAG='Y' QUALIFY DENSE_RANK() OVER (ORDER BY LOAD_TIMESTAMP DESC )=1 ) Looks like ...
0 votes
0 answers
13 views

Get the row from previous load date in BigQuery

I have a table in BigQuery with 2 dates, the reception date and the date load date. I need to set a mark on the last LOAD_DATE before the RECEPCION_DATE and another mark, on the first load of the same ...
0 votes
2 answers
107 views

Snowflake row_number function is returning inconsistent results between CTE and view

I currently have a dataset, where it is possible for an person to have multiple records in one month, and I only want to take the first. To do this, I am using the row_number function, and my code is ...
0 votes
1 answer
52 views

How to select winner of condorcet election via matrix?

I would like to understand how the condorcet winner is elected in a ranked-choice election. There is an example on wikipedia - under the sub-heading "Pairwise counting and matrices" under ...
0 votes
0 answers
36 views

How to use gurobi to describe the process of finding the rank of matrix?

If have a general square matrix[[1,1,0],[1,1,0],[0,0,0]].(the element is on a binary field--Galois Fields) I want to find the rank of this matrix(like the function:np.linalg.matrix_rank). How can ...
4 votes
5 answers
4k views

What is the command for Zipf (frequency against rank) plot in R

I have from a network traffic data, data volume (# of bytes) and # of flows over a week period for origin and destination IP pair. I want to plot distribution, i.e. frequency against rank. I believe ...
0 votes
0 answers
52 views

RANKX doesn't work once filter is applied to visual

I have been looking all over the internet but can't find a solution that works for me. Hopefully someone here knows how to solve this problem. I have a dataset with a year, country, product and sales, ...
0 votes
2 answers
60 views

How to rank the values across multiple columns per row

I have a dataframe with 4 columns as follows: index 1 index 2 index 3 index 4 date 2023-07-14 0.0585 0.0775 -0....
0 votes
1 answer
54 views

How do I get the first row based on three columns, an id, document number and a timestamp, during a specific time?

I'm trying to find a solution for a case at work that basically is: We have a database that registers all the api requests and responses. We need to match the number of requests that are charged by ...
1 vote
3 answers
60 views

Column with ranking based on other columns but like tie breaker

I've got a dataframe: df = pd.DataFrame({ "DScore": [2, 2, 3, 4, 5], "EScore": [6, 7, 9, 9, 10], "Total Score": [17, 15, 15, 23, 25] }) I want to write the ...
31 votes
7 answers
59k views

How to rank within groups in R?

This is my dataframe: customer_name order_dates order_values 1 John 2010-11-01 15 2 Bob 2008-03-25 12 3 Alex 2009-11-15 5 4 ...
0 votes
1 answer
80 views

Assign ranking to IPs based on frequency, within rolling windows

Within each ID, I'm trying to rank each IP based on how often they show up within the last 3 months. For example, in the table below, the IP 98.28.88.148 should have a ranking of 1 because they showed ...
3 votes
1 answer
103 views

RANK & DENSE_RANK as aggregate(not analytic) function

Is there any option to use RANK/DENSE_RANK function in SQL Server as aggregate? For example the below query in Oracle/Postgres returns hypothetical ranking of the value 200 in the orders table based ...
0 votes
0 answers
8 views

Can 2 pairs of Random variables, X - Y & X -Z have same absolute value of kendals tau. Can we simulate such data? Are there any real data examples?

I have a theoretical situation where all data should have unique absolute value of kendals tau. I want to study the effect if this condition is not met. Can we simulate data such that X,Y and X,Z have ...
0 votes
0 answers
77 views

Excel Rank - Skipping Ranks

I am trying to have a RANK formula that does not skip any whole numbers (e.g. 1,2,3,4,5,6,7,8,9,10) Screenshot showing the current rank I have this formula that is dividing the number down into ...
24 votes
7 answers
51k views

Pandas rank by multiple columns

I am trying to rank a pandas data frame based on two columns. I can rank it based on one column, but how can to rank it based on two columns? 'SaleCount', then 'TotalRevenue'? import pandas as pd df ...
0 votes
0 answers
50 views

Excel pivot table : rank groups by same sub category

In a pivot table I have groups, each group has 5 same sub categories in percentages of the total of each group : cat1, cat2, cat3, cat4 and cat5, as follows : GroupA = 100% cat 1 = 23% cat 2 = 12% ...
2 votes
1 answer
2k views

Power BI Add rank or row number to column

Im trying to add just a simple rank numbering or row number to column but no luck. I have a simple test table which consist of 2 columns - Name and Room number. I have attached Room Number to filter ...
0 votes
1 answer
67 views

Writing group ranking without for-loops in Python + NumPy

My goal is two create a function that takes in two input arrays and outputs ranks withing groups. More specifically, the first input to the function is an array of scores (scores, and the second input ...
1 vote
2 answers
68 views

Ranking by groups of continuous equal values

With this query: with tbl as ( select 1 ord, 'A' name from dual union all select 2 ord, 'A' name from dual union all select 3 ord, 'A' name from dual union all select 4 ord, 'B' name ...
-1 votes
1 answer
2k views

How to assign unique rank number for duplicate values in R

I have a large data set like the below example, How to assign a unique rank number to duplicate or repeated values with a combination of more than one column condition. like rank to be assigned with ...
0 votes
2 answers
93 views

Libreoffice Calc: How to rank numbers without skipping ranks? [closed]

I have a table with Points/Game in one column and I want to rank the teams by relative place in the second column, but the RANK function does not do what I was hoping and adds all tied places to the ...
0 votes
1 answer
23 views

RANX returning 1's only when grouping applied

In Power Pivot, this DAX formula ranks all values in the Sales column: =RANKX(ALL(Table2),[Sales]) The resulting table: Group | Sales | Calculated Column A | 2 | 4 A | 3 | 3 B | 4 ...
1 vote
1 answer
110 views

Converting a sparse R integer dgCMatrix to a corresponding sparse R rank dgCMatrix

This another question about efficient handling of a large R sparse Matrix (dgCMatrix): I would like to convert my existing ~15,000 x ~90,000 dgCMatrix to a corresponding rank dgCMatrix, where rank ...
0 votes
0 answers
29 views

How to create an average, rank, total measures over a field (by dynamic period) in SSAS

I'm new with SSAS technology and I have an existing cube that measures hits by page on web site. In few words the cube is structured as followed: a dimension 'Expression' that contains reference to ...
0 votes
0 answers
14 views

Finding uniform set of Rows returned by rank in Postgresql

I have a table in Postgresql for which I performed analytical function and grouped as lastest records based on column_3 table 1: now as per the resulset org:2 have latest date(29-07-2023) so I ...
12 votes
4 answers
21k views

Alexa Rank to Traffic Estimation Formula

Anybody have some idea how we can convert alexa Rank to estimate the daily visitors of a website. previous we can easily do this by Alexa Site Reach percentage but alexa reach is no more available. ...
-2 votes
1 answer
90 views

Can alexa toolbar watch popups? [closed]

i have a website and i open a popup containing my other website. if a user has alexa toolbar on his browser, Can Alexa watch that popup website or just the main webpage?
0 votes
1 answer
2k views

How can I get Alexa rank from client side (jQuery)?

I need to read Alexa rank from client side with usage of jQuery. The URL is like this: http://data.alexa.com/data?cli=10&data=snbamz&url=http://www.facebook.com The returned object is XML ...
-1 votes
1 answer
43 views

rank error in php displaying one rank only

$avr = intval($result->markk / 11); $numbers = array($avr); rsort($numbers); $arr = $arr1 = array(); $i = $rank = 1; foreach ($numbers as $key => $value) { $arr[$value][] = $value; } ...
0 votes
0 answers
34 views

rank function for mysqli 5.7 version [duplicate]

I was using the Rank() function on mysql and it was not working. I want exactly the rank function type of codes which skips one rank after double rank occurs and I didn't get any. This is the query: ...
1 vote
1 answer
64 views

Ranking a list of terms by the values in several columns

I manage a film festival that holds an annual 'best film' competition. There can be up to 50 films and any number of judges each year. I plan to use R to analyse the various judges' scores then ...
0 votes
0 answers
31 views

assessing stochastic dominance?

According to wikipedia and other scattered software documentation Kruskal Wallis tests assess "stochastic dominance". But which type of stochastic dominance from those discussed here? The ...
0 votes
1 answer
391 views

Power BI DAX RankX only returns 1

I am new in Dax and I am studying the Rankx function. I have a simple table with Id, price, product, category. When I use the function in the folowing way I only get rank 1 for all products and I am ...
0 votes
1 answer
94 views

In Excel, how can I PercentRank only values above a certain threshold in one column?

In Microsoft Excel, I'm looking to percentrank values in one column, but I'd only like to rank those that are that are above 1,000. All the others that are below 1,000, I'd like to leave a zero. Here'...

1
2 3 4 5
34