Skip to content

Fixed issue on Top 12 German Companies sample #1186

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

Closed
wants to merge 1 commit into from

Conversation

kikoso
Copy link

@kikoso kikoso commented May 11, 2025

This PR modifies the handling of the ROA and ROE columns in the 12 German Companies example to address formatting issues. The values were initially strings with periods (e.g., 12.5), which caused incorrect calculations. This PR removes the periods and converts the values to Double to ensure accurate computation of the mean and standard deviation.

@Jolanrensen
Copy link
Collaborator

In the cell you modified:

// Group data by sector to compute average and standard deviations of ROA and ROE
val roeAndRoaDf = companiesDf.groupBy { sector }.aggregate {
    ROA.mean() into "Avg ROA"
    ROA.std() into "Std ROA"
    ROE.mean() into "Avg ROE"
    ROE.std() into "Std ROE"
}

roeAndRoaDf

the columns ROA and ROE are both of type Double, not String.
They are Double already from the 4th cell and the line: .convert { ROA and ROE }.with { it.replace(".", "").toDouble() }, so the calculation is done correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants