Data Frames
Creation dictionary of Series, - from list of dictionaries, Text/CSV files;
display; iteration;
Data Frame: It is a two-dimensional object that is useful in representing data in the form of rows and
columns. It is similar to a spreadsheet or an SQL table. This is the most commonly used pandas
object. Once we store the data into the Dataframe, we can perform various operations that are useful
in analyzing and understanding the data.
DATA FRAME STRUCTURE
•
• A Dataframe has axes (indices)-
Row index (axis=0)
Column index (axes=1)
• It is similar to a spreadsheet, whose row index is called index and column index is called
column name.
A Dataframe contains Heterogeneous data.
A Dataframe Size is Mutable.
A Dataframe Data is Mutable.
• A data frame can be created using any of the following
Series
Lists
Dictionary
A numpy 2D array
Operations on rows and columns
add, select, delete, rename,Head and Tail functions; Indexing using Labels,
Boolean Indexing;
MAIN POINTS
Modify the Data Frame- We can modify the existing data frame by Adding new row/columns,
change the existing value of Row & Columns, rename the column/row and delete the row/columns.
1. Adding new column in existing DataFrame - Suppose a Existing DataFrame DF is like as
DF
For modify multiple row values, we can do it as-
DF.loc[2:4,:]=200 or DF.at[2:4,:]=200,then Frame will be –like