# import the pandas library import pandas as pd # Dictionary of key pair values called data data = {'Name':['Ashika', 'Tanu', 'Ashwin', 'Mohit', 'Sourabh'], 'Age': [24, 23, 22, 19, 10]} data # Calling the pandas data frame method by passing the dictionary (data) as a parameter df = pd.DataFrame(data) df # import the pandas library import pandas as pd # Dictionary of key pair values called data data = {'Name':['Ashika', 'Tanu', 'Ashwin', 'Mohit', 'Sourabh'], 'Age': [24, 23, 22, 19, 10]} data # Calling the pandas data frame method by passing the dictionary (data) as a parameter df = pd.DataFrame(data) # Selecting column df[['Name']] # import the pandas library import pandas as pd # Dictionary of key pair values called data data = {'Name':['Ashika', 'Tanu', 'Ashwin', 'Mohit', 'Sourabh'], 'Age': [24, 23, 22, 19, 10]} data # Calling the pandas data frame method by passing the dictionary (data) as a parameter df = pd.DataFrame(data) # Selecting a row row = df.loc[1] row # import the pandas library import pandas as pd # Dictionary of key pair values called data data = {'Name':['Ashika', 'Tanu', 'Ashwin', 'Mohit', 'Sourabh'], 'Age': [24, 23, 22, 19, 10]} data # Calling the pandas data frame method by passing the dictionary (data) as a parameter df = pd.DataFrame(data) # Selecting the data from the column df['Age'] del df['Age'] df df.insert(1, 'name', df['Name']) df # importing both pandas and numpy libraries import pandas as pd import numpy as np # Dictionary of key pair values called data data ={'Name':['Tanu', np.nan], 'Age': [23, np.nan]} data df = pd.DataFrame(data) df # using the isnull() function df.isnull() df.fillna(0) # import the pandas library import pandas as pd # Dictionary of key pair values called data data = {'NAMe':['Ashika', 'Tanu', 'Ashwin', 'Mohit', 'Sourabh'], 'AGe': [24, 23, 22, 19, 10]} data # Calling the pandas data frame method by passing the dictionary (data) as a parameter df = pd.DataFrame(data) df newcols = { 'NAMe': 'Name', 'AGe': 'Age' } # Use `rename()` to rename your columns df.rename(columns=newcols, inplace=True) df # The values of new index newindex = { 0: 'a', 1: 'b', 2: 'c', 3: 'd', 4: 'e' } # Rename your index df.rename(index=newindex)