Pivot Tables
- The last section was nice, and helpful but cumbersome.
- I like pivot tables much better.
- This is all part of the new "Data Science"
- Pivot tables are for aggregating data.
- So you need a dataset like the one Homicide data from the last notes.
- Data that needs summarized.
- In this case, multiple crimes over multiple years,....
- Select any cell
- Click on the Inserttab and select Pivot Table from the tables group.
- This will place us on a new worksheet.
- Let's first rebuild the totals by year.
- Simply grab the year in the PivotTable Fields area and throw it in the Rows area.
- Now grab the Victims field and trow it in the Values area.
- Select either count or sum.
- We can perform the second search as well.
- Remove year from the rows area
- But place Offender Sex and Death Circumstance here.
- Notice how it is sorted.
- But this is not the real strength.
- What if we want to see a relationship between the victim and offender?
- Drag Victim Sex into the Columns area.
- Sometimes it is useful to switch rows and columns
- Rows: Offender Sex, Columns Weapon is bad, but the opposite is good.
- Take some time to explore this dataset.