Lecture 15 (DS) - Pandas - DataFrame Merging, String Operations
Lecture 15 (DS) - Pandas - DataFrame Merging, String Operations
Lecture # 16
Pandas
• Often we need –
to Merging
work with dataDataFrame
from
multiple frames
• A common practice is to merge two frames
into one like join operatoin
• By the end of this lecture, you should be able
to
data sets
Note: All Images are taken from edx.org
Example DataFrames
preserved
Note: All Images are taken from edx.org
pandas.concat() : Stack DataFrames
• Here is the
example of
concatenating
two different data
frames
• Please note the
appearance of
NaNor missing
values if a
column is missing
5
• Instead of having extra rows with missing numbers, we can use inner
join
• In previous slide, concatenated DataFrames stacked vertically
• Here they are placed next to each other horizontally
• This is also not perfect because key columns have been duplicated
6
• An alternative to
concat is append
• It behaves
similarly to
concat function
• But it is a
function of
DataFrame itself
11
12
• http://pandas.pydata.org/pandas-docs/stable/te
xt.html#text-sting-methods
• Discuss Case Study: Movie Data Analysis
13
14
• Unit = All
Note: ‘s’Images
declared thatfrom
are taken unit is seconds
edx.org
Select Rows Based on Timestamps
16
17
• Then we discuss
basic statistical
operations on Series
and DataFrames
• We discussed joined
descriptive statistics
and individual
functions for
generating min, max
etc
19
• We went through
data preparation and
exploration options in
Pandas like isnull, any
and dropna functions
20
• We also overview
data visualization
• We saw examples of
inline plots, box plots
and histogram using
Panda’s plot function
21
• We talked about
slicing out rows and
filtering data frames,
as well as
aggregating data
using the groupby
operation
22
23
24
• Finally, we talked
about how to work
with time stamps
25