To get all the unique values from a pandas series, except for NaN, you can use the dropna()
method along with the unique()
method. Here's an example:
main.py218 chars10 lines
Output:
main.py17 chars2 lines
First, we use the dropna()
method to remove all the NaN values from the series. Then we use the unique()
method to get all the unique values from the series.
gistlibby LogSnag