Lecture 21 Working With Pandas
Lecture 21 Working With Pandas
You can have already a Python data object which you can provide as argument to a
DataFrame constructor as illustrated with the following example:
Convert Python data into a ``DataFrame``
➢ In many cases, we will require the rows to be associated with names, or sometimes
called as keys. For example, instead of referring to a row as “the row at index 1”,
we might require accessing a row with a non-integer value.
➢ This can be achieved as follows (note how the printed DataFrame looks different):
Accessing Data with DataFrames
➢ We can access data columnwise or row-wise.
1. Column wise access 2. Rowwise access.
Modifying Data with DataFrames
Analyzing Data with DataFrame
➢ Once we have our data in a DataFrame, we can use Pandas’s built-in facilities for
analyzing our data.
➢ One very simple way to analyze data is via descriptive statistics, which you can
access with df.describe() and df[<column>].value_counts():