Python for Data Science Essential Training is one of the most popular data science courses at LinkedIn Learning. It has now been updated and expanded to two parts-for even more hands-on experience with Python. In this course, instructor Lillian Pierson takes you step by step through a practical data science project: a web scraper that downloads and analyzes data from the web. Along the way, she introduces techniques to clean, reformat, transform, and describe raw data; generate visualizations; remove outliers; perform simple data analysis; and generate interactive graphs using the Plotly library.
As the Founder of Data-Mania LLC, Lillian offers online and face-to-face training courses, as well as workshops and other educational materials in the area of big data, data science, and data analytics.
The four flavors of data analysis 3m 16s
Data analysis
Data science
Artificial intelligence
Machine learning
Prediction is where you do the predictive modeling within data science
Execution is the autonomous response from the engineered systems.
Set of predictive methodologies.
Why use Python for analytics? 4m 22s
vs R, Julia, Go
Advanced Data Analysis: NumPy, SciPy, pandas
Data visualization: Matplotlib, Seaborn
Machine learning: scikit-learn, TensorFlow (DeepLearn), Keras (DeepLearn)
High-level course road map 1m 28s
# Save workbook as HTML
import os
os.system('jupyter nbconvert --to html 1_filter_select.ipynb')
numpy - basis for several python data science tools.
pandas- fast clean, prep, analysis; visualization; machine learn.
built on NumPy; arrays (series), matrices (dataframes)
index with [] or .loc[]
DF_obj.loc[['row 2', 'row 5'], ['col 5', 'col 2']]
pd.Series(np.arange(2), index=['row 1', 'row 2'])
pd.DataFrame(np.random.rand(36).reshape((6,6)),
index=['row 1', 'row 2'],
columns=['col 1', 'col 2'])
pd.series_obj[0,7] # Get values.
pd.series_obj[[0,7]] # Get label index and value.
series_obj['row 3' : 'row 7']
series_obj[series_obj > 6]
jupyter notebook
win: shft+enter
mac: shft+return
Missing values: NaN = not a number
Drop 0s, 99s, 999s
np.nan
pd.Series.isnull()
pd.DataFrame.fillna(0)
pd.DataFrame.fillna({0: 0.1, 5: 1.25}) - Fill column 0 na's with 0.1; fill column 5 na's with 1.25.
pd.DataFrame.fillna(method='ffill') - Forward fill all na's.
pd.DataFrame.loc[3:5,0] = np.nan - Manually set DF cells with loc[] cmd.
pd.DataFrame.isnull().sum() - Get column-wise counts of null values.
pd.DataFrame.dropna() - Drop all rows with na's.
pd.DataFrame.dropna(axis=1) - Drop all cols with na's.
Maintain consistent datasets
Avoid erroneous or misleading statistics
Find duplicates | duplicated() and drop_duplicates()
pd.DataFrame.duplicated() # List row #'s with duplicated values
pd.DataFrame.drop_duplicates() # Drop row #'s with duplicated values
pd.DataFrame.drop_duplicates(['col 3']) # Index label
pd.concat([DF_obj, DF_obj2]) # join rows
pd.concat([DF_obj, DF_obj2], axis=1) # join columns
DF_obj.drop([0, 2]) # drop row 0 and 2
DF_obj.drop([0, 2], axis=1) # drop col 0 and 2
Add new column - join()
series_obj = Series(np.arange(6))
series_obj.name = "Age"
DataFrame.join(DF_obj, series_obj)
Add new rows - append()
DF_obj.append(DF_obj2, ignore_index=True)
Sort data - sort_values()
# Sort col 5 in descending order
DF_obj.sort_values(by=(5), ascending=False)
Compare subsets
Deduce why subgroups differ
Subset for analysis
Read CSV - read_csv() and head()
cars = pd.read_csv("C:\py_data\mtcars.csv")
cars.columns = ['car_names', 'mpg', 'cyl', 'disp', 'hp', 'drat', 'wt', 'qsec', 'vs', 'am', 'gear', 'carb']
cars.head()
Group by col index - groupby()
cars_groups = cars.groupby(['cyl'])
cars_groups.mean()
Subset cols - [[‘c1’, ‘c2’]]
cars_subset = cars[['mpg', 'disp', 'hp', 'wt']]
cars_subset.head()
The three types of data visualization 7m 40s
Selecting optimal data graphics 6m 17s
Communicating with color and context 4m 38s
Creating standard data graphics 8m 42s
Defining elements of a plot 9m 6s
Plot formatting 12m 8s
Creating labels and annotations 14m 30s
Visualizing time series 6m 33s
Creating statistical data graphics 9m 59s
Simple arithmetic 6m 53s
Basic linear algebra 6m 17s
Generating summary statistics 9m 46s
Summarizing categorical data 12m 25s
Parametric correlation analysis 15m 15s
Non-parametric correlation analysis 13m 25s
Transforming dataset distributions 9m 54s
Extreme value analysis for outliers 11m 5s
Multivariate analysis for outliers 5m 53s
BeautifulSoup object 18m 28s
NavigableString objects 10m 1s
Data parsing 12m 42s
Web scraping in practice 10m 48s
Introduction to NLP 12m 31s
Cleaning and stemming textual data 7m 47s
Lemmatizing and analyzing textual data 10m 15s
Introduction to Plotly 4m 31s
Create statistical charts 3m 28s
Line charts in Plotly 6m 29s
Bar charts and pie charts in Plotly 7m 24s
Create statistical charts 15m