How to extract an entire column from a Pandas dataframe?

We can select an entire column using the [ ] operator.


import pandas as pd

users = [('Ali', 'M', 'Lahore', 20000),
            ('Jhon', 'M', 'Dubai', 25000),
            ('Wick', 'M', 'London', 40000),
            ('Harry', 'M', 'Manchester', 35000),
            ('Snape', 'M', 'Hogwards', 30000),
            ('Hermoine', 'F', 'New York', 20000),
            ('Ayesha', 'F', 'Karachi', 24000),
            ('Julie', 'F', 'Miami', 70000)

#Create a sample dataframe and setting name as index column
df = pd.DataFrame(users, columns =['Name', 'Sex','City', 'Income'])
df.set_index("Name", inplace = True)

#selecting the entire name column
data = df["Name"]