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

Why is there no fuction for calculating the mean, such as mean or meanby? #412

Open
simbahebinbo opened this issue Dec 28, 2023 · 0 comments

Comments

@simbahebinbo
Copy link

simbahebinbo commented Dec 28, 2023

package main

import (
	"fmt"
	"github.com/samber/lo"
)

func main() {
	// 一组数字
	numbers := []float64{1.0, 2.5, 3.7, 4.2, 5.1}

	// 使用 lo 包计算平均值
	average := lo.Mean(numbers)

	// 打印结果
	fmt.Printf("平均值: %f\n", average)
}
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

No branches or pull requests

1 participant