Reveal.js
Copyright (C) 2011-2024 Hakim El Hattab, http://hakim.se, and reveal.js contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
KaTeX
The MIT License (MIT)
Copyright (c) 2013-2020 Khan Academy and other contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
COMP 521 · Tables, selections, and scientific plots
COMP 521 · 30-minute introduction
Pandas and exploratory data analysis
From labelled observations to inspectable evidence
Anna Rosen · San Diego State University
A Python library for labelled data
What is Pandas?
What it provides
DataFrame: a table with row and column labels.
Series: one labelled sequence, such as a column.
Tools to read files, select records, handle missing values, and summarize data.
Where it fits
NumPy computes with arrays. Pandas adds table labels and column types. Matplotlib draws the plots.
The usual import
import pandas as pd
pd is an alias for the library, not a dataset.
Choose a representation for the task
Compare the data containers
Container
How you address data
What it organizes
Python list
Positions
A sequence of objects
Python dictionary
Keys
Key–value associations
NumPy array
Positions in a shape
An array with one dtype
Pandas Series
Index labels or positions
One labelled sequence with one dtype
Pandas DataFrame
Row/column labels or positions
A table with one dtype per column
A dictionary can supply a table’s columns. A DataFrame adds a shared row index and table operations; each column is a Series.
sample exposure_s signal quality
r10 A 1.0 2.0 ok
r11 B 2.0 3.0 ok
r12 C 2.5 3.0 ok
r14 E 4.0 18.0 flagged
For this plot, retain rows with exposure and signal. Do not remove missing values separately from the two columns and then pair positions.
One published parameter set per planet
The CSV has a source contract
The saved NASA Planetary Systems (ps) query retains one default published parameter set per planet, with names and source references.
Read your saved Project 4 file
raw = pd.read_csv(
'project4-nasa-exoplanets.csv',
comment='#')
CSV is a text format with a header and comma-separated records. read_csv returns a DataFrame. Blank fields usually become missing values; check inferred types.
Save the CSV beside your own notebook. Keep the query and retrieval date.
Source before selection
Inspect what was read
(437, 15)
pl_name pl_masse pl_rade
TRAPPIST-1 h 0.326 0.755
TRAPPIST-1 d 0.388 0.788
KOI-55 b 0.440 0.759
L 98-59 b 0.460 0.837
raw.shape gives the dimensions. raw.head(4) previews the four rows shown here; raw.head() defaults to five. Inspect column types with raw.dtypes.
This snapshot has 437 rows and 15 columns. A later live query may differ.