Pandas 1.x Cookbook by Matt Harrison Theodore Petrou

Pandas 1.x Cookbook by Matt Harrison Theodore Petrou

Author:Matt Harrison, Theodore Petrou
Language: eng
Format: mobi, epub
Tags: COM051360 - COMPUTERS / Programming Languages / Python, COM018000 - COMPUTERS / Data Processing, COM021030 - COMPUTERS / Databases / Data Mining
Publisher: Packt
Published: 2020-02-25T11:41:07+00:00


This output isn't quite what we desire. We are not looking for the mean and standard deviations of the entire group but the maximum number of standard deviations away from the mean for any one institution. To calculate this, we need to subtract the mean undergraduate population by state from each institution's undergraduate population and then divide by the standard deviation. This standardizes the undergraduate population for each group. We can then take the maximum of the absolute value of these scores to find the one that is farthest away from the mean. pandas does not provide a function capable of doing this. Instead, we will need to create a custom function: >>> def max_deviation(s): ... std_score = (s - s.mean()) / s.std() ... return std_score.abs().max()



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.