#!/usr/bin/env python # coding: utf-8 # In[21]: import pandas as pd import matplotlib.pyplot as plt from matplotlib import style style.use("fivethirtyeight") dictionary = {"Rank": [3, 2, 4, 5, 6], "Name": ["Tanu", "Ashika", "Ashwin", "Mohit", "Sourabh"], "Age": [23, 24, 22, 18, 9], "Weight": [69, 72, 65, 70, 40], "Occupation": ["Student", "Working", "Working", "Student", "Student"]} df = pd.DataFrame(dictionary) # Slicing the dataframe df.head(3) # In[22]: df.tail(1) # In[23]: dictionary1 = {"Rank": [1], "Name": ["Tilo"], "Age": [80], "Weight": [80], "Occupation": ["Kitchen Queen"] } df1 = pd.DataFrame(dictionary1) # Concatenating the two dataframes (df, df1) df_row = pd.concat([df, df1]) df_row # In[24]: # To set the first as Rank df_row.set_index("Rank", inplace = True) # To sort the data Rank in the ascending order df_row.sort_values(by=['Rank']) # In[25]: df_row.plot() plt.show() # In[ ]: