Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

finding the Unique values in data

##finding the Unique values in data ie: Age

df['Age'].unique()
Comment

How to Find Unique Values in a Column in Pandas

# 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 column fruits
print(df.fruits.unique())
Comment

Getting unique values in a column

# 10. Getting unique names of values in a column
df['Airline'].unique()
Comment

PREVIOUS NEXT
Code Example
Python :: python close file 
Python :: list comprehenstsion using lambda funcion 
Python :: pycairo 
Python :: Palindrome Check using for loop in python 
Python :: take the first in dataloader pytorch 
Python :: pyqt5 image 
Python :: km/h a m/s 
Python :: stack data horizontally pandas 
Python :: zip django template 
Python :: how to make calculator in python 
Python :: django template date format yyyy-mm-dd 
Python :: nohup python command for linux 
Python :: python open file relative to script location 
Python :: discord.py embeds 
Python :: replace value in dataframe 
Python :: are tuples mutable 
Python :: df = df.reset_index(level=0) 
Python :: python print raw string 
Python :: turtle example in python 
Python :: pandas select columns by index 
Python :: ValueError: `logits` and `labels` must have the same shape, received ((None, 2) vs (None, 1)). 
Python :: create and populate dictionary python 
Python :: how to use the random module in python 
Python :: django createmany 
Python :: remove extra spaces python 
Python :: python send http request 
Python :: how to round off values in columns in pandas in excel 
Python :: endswith python 
Python :: print a formatted table using python 
Python :: append item to array python 
ADD CONTENT
Topic
Content
Source link
Name
1+1 =