'ValueError: min() arg is an empty sequence. What could be going wrong?

I'm trying to implement the following code.

GP Winners

driver_winner = df.loc[df['position_order']==1].groupby('driver') 
['position_order'].count().sort_values(ascending=False).to_frame().reset_index()

Barplot

sns.barplot(data = driver_winner, y = 'driver', x = 'position_order', color = 'green', alpha = 
0.8)
plt.title('Most GP Winners in F1')
plt.ylabel('Driver Name')
plt.xlabel('Number of GP wins')
plt.yticks([])

But instead of getting the barplot I get the ValueError: min() arg is an empty sequence.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source