Question: I have a question whether `RANK () OVER` function can give the 'most popular' value?

Question:

> 
> What route was the most popular of those with an average trip time of at least 8 minutes, excluding trips longer than 2 hours?
> 
> 
> 

Can someone confirm whether `RANK() OVER` satisfies this 'popularity' value?

Answer: 
It seems that you want to convert the DataFrame into a 1D array (**this should be clear in the post**).

First, convert the DataFrame to a 2D numpy array using `DataFrame.to_numpy` (using `DataFrame.values` is discouraged) and then use `ndarray.ravel` or `ndarray.flatten` to flatten the array.

```
arr = df.to_numpy().ravel()

```
```
np = df.values

```

Dataframe contains values property. This property actually holds data as a NumPy array.

Convert n-dimensional numpy array to 1D numpy array .

```
data = df.values 

# method 1 
raval = data.ravel() 

#method 2 
shape = data.shape 
1d_data = data.reshape(1,shape[0]*shape[1])

```