huggingface / setfit

Efficient few-shot learning with Sentence Transformers
https://hf.co/docs/setfit
Apache License 2.0
2.24k stars 222 forks source link

Fix pandas groupby -> apply warning #555

Closed tomaarsen closed 2 months ago

tomaarsen commented 2 months ago

Hello!

Pull Request overview

Details

Previously, this warning would trigger:

DeprecationWarning: DataFrameGroupBy.apply operated on the grouping columns. This behavior is deprecated, and in a future version of pandas the grouping columns will be excluded from the operation. Either pass `include_groups=False` to exclude the groupings or explicitly select the grouping columns after groupby to silence this warning.

Now, we use head to sample per group. Because the dataset is already shuffled, this is equivalent to using sample as we did before.

HuggingFaceDocBuilderDev commented 2 months ago

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.