Articles → Pandas → DataFrame in pandas

DataFrame in pandas

What is DataFrame?

Picture showing the pictorical representation of the dataframe

Click to Enlarge


import numpy as np
import pandas as pd

pd.DataFrame(np.random.randn(5,4),['A', 'B', 'C', 'D', 'E'],['W', 'X', 'Y', 'Z'])

Picture showing the output of the dataframe in pandas

Click to Enlarge

Access elements in DataFrame

import numpy as np
import pandas as pd

df = pd.DataFrame(np.random.randn(5,4),['A', 'B', 'C', 'D', 'E'],['W', 'X', 'Y', 'Z'])


# You can also use df.W

Picture showing how the data is accessed column-wise in dataframe

Click to Enlarge

Posted By  -  Karan Gupta
Posted On  -  Thursday, April 11, 2019


Your Email Id  
Query/FeedbackCharacters remaining 250