df.unique()
时间: 2024-05-05 14:17:20 浏览: 68
pandas dataframe 中的explode函数用法详解
As an AI language model, I don't have access to any specific dataframe. However, I can provide a general explanation of what the method `df.unique()` does.
`df.unique()` is a method that can be used on a pandas dataframe `df`. It returns an array of unique values in the dataframe column(s). It can be used to identify the unique values in a dataframe column or multiple columns.
For example, if we have a dataframe with a column called "fruit" and we want to know the unique values in that column, we can use the following code:
```
import pandas as pd
df = pd.DataFrame({'fruit': ['apple', 'banana', 'apple', 'orange', 'banana']})
unique_fruits = df['fruit'].unique()
print(unique_fruits)
```
Output:
```
['apple' 'banana' 'orange']
```
This code will return an array of unique values in the "fruit" column of the `df` dataframe, which are 'apple', 'banana', and 'orange'.
阅读全文