You are on page 1of 14

Notes on Pandas (DataFrame (XII))

DataFrame
 Sometimes we need to work on multiple columns at a time, i.e., we need to process the tabular data. For
example, the result of a class, items in a restaurant’s menu, reservation chart of a train, etc.
 Pandas store such tabular data using a DataFrame.
 A DataFrame is a two-dimensional labelled data structure like a table of MySQL.
 It contains rows and columns, and therefore has both a row and column index. Each column can have a
different type of value such as numeric, string, boolean, etc., as in tables of a database.

DataFrame object can be created by passing data in many different ways


1. Using 2D dictionaries
a. Creating a dataframe from 2D dictionary having values as list/ndarrays.
b. Creating a dataframe from 2D dictionary having values as dictionary objects.
c. Creating a dataframe from 2D dictionary with values as series object.
2. Using List of Dictionaries/Lists
3. Using 2-D ndarrays(Numpy array)
4. Using series type object
5. Using another DataFrame object
Selecting individual values

Deleting a column from DataFrame


Deleting a row from DataFrame

iterrows()
iteritems()

Practice questions

You might also like