In [1]:
import pandas as pd
In [2]:
# Import a CSV as pandas DataFrame
df = pd.read_csv('salaries.csv')
In [3]:
df
Out[3]:
In [4]:
# Get a spefic column from the DataFrame
df['Name']
Out[4]:
In [5]:
df['Salary']
Out[5]:
In [6]:
df[['Name', 'Salary']]
Out[6]:
In [7]:
df['Age']
Out[7]:
In [8]:
# Calculate mean value for the column
df['Age'].mean()
Out[8]:
In [9]:
# Mask
df['Age'] > 30
Out[9]:
In [20]:
age_filter = df['Age'] > 30
In [11]:
df[age_filter]
Out[11]:
In [21]:
# Filter the DataFrame
# And return values that comply with the filtering requirements
df[df['Age'] > 30]
Out[21]: