import pandas as pd
colors = {'color': ['green', 'blue', 'blue', 'red', 'green']}
df = pd.DataFrame.from_dict(colors)
print(df['color'].unique())
>gapminder['continent'].unique()
array(['Asia', 'Europe', 'Africa', 'Americas', 'Oceania'], dtype=object)
# import pandas library
import pandas as pd
# create pandas DataFrame
df = pd.DataFrame({'fruits': ['orange', 'mango', 'apple', 'grapes', 'orange', 'mango'],
'price': ['40', '80', '30', '40', '30', '80'],
'quantity': ['200', '300', '300', '400', '200', '800']
})
# get the unique value of all columns
for col in df:
print(df
.unique())
#column name ISSDTM
pd.to_datetime(df.ISSDTM, errors='coerce').dt.year
#result
0 2013
1 2013
2 2009
3 2009
Name: ISSDTM, dtype: int64