Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: add transform() function to produce tables with age-wise rows and year-wise columns #6

Closed
patrickm663 opened this issue Jan 30, 2024 · 1 comment · Fixed by #7
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@patrickm663
Copy link
Owner

When dealing with mortality data, it is typical to 'square' it into an $n\times m$ matrix, where entries $m(x,t)$ correspond to the mortality rate for a life aged $x$ in cohort/year $t$.

A function like transform() & transform!() could take in mortality date and apply this transformation. Where there are multiple representations of the mortality data (e.g. males, females, total), a Dict could be returned with DataFrame objects as values, so t["Males"] returns a DataFrame of transformed Male rates. Similarly, a custom struct could work.

@patrickm663 patrickm663 added enhancement New feature or request good first issue Good for newcomers labels Jan 30, 2024
@patrickm663
Copy link
Owner Author

This will basically be a wrapper for DataFrames.unstack(df, :Year, :Male) but to handle cases where e.g. :Male may be ambiguous and there may be arbitrary columns to handle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
1 participant