Repository: Zeroto521/my-data-toolkit

Issue:
PERF: `to_set` speeds up especial to large data
<!--
Thanks for contributing a pull request!

Please follow these standard acronyms to start the commit message:

- ENH: enhancement
- BUG: bug fix
- DOC: documentation
- TYP: type annotations
- TST: addition or modification of tests
- MAINT: maintenance commit (refactoring, typos, etc.)
- BLD: change related to building
- REL: related to releasing
- API: an (incompatible) API change
- DEP: deprecate something, or remove a deprecated object
- DEV: development tool or utility
- REV: revert an earlier commit
- PERF: performance improvement
- BOT: always commit via a bot
- CI: related to CI or CD
- CLN: Code cleanup
-->

- [x] closes #542
- [x] whatsnew entry

Apply to index accessor


Discussion:
# [Codecov](https://codecov.io/gh/Zeroto521/my-data-toolkit/pull/543?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Zero) Report
> Merging [#543](https://codecov.io/gh/Zeroto521/my-data-toolkit/pull/543?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Zero) (3e4ba6b) into [main](https://codecov.io/gh/Zeroto521/my-data-toolkit/commit/775b41ed01c4578297c4b42de7e026eaf518d048?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Zero) (775b41e) will **not change** coverage.
> The diff coverage is `100.00%`.

```diff
@@           Coverage Diff           @@
##             main     #543   +/-   ##
=======================================
  Coverage   99.63%   99.63%           
=======================================
  Files          59       59           
  Lines         816      816           
  Branches       89       89           
=======================================
  Hits          813      813           
  Misses          1        1           
  Partials        2        2           
```


| [Impacted Files](https://codecov.io/gh/Zeroto521/my-data-toolkit/pull/543?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Zero) | Coverage Δ | |
|---|---|---|
| [dtoolkit/accessor/index/to\_set.py](https://codecov.io/gh/Zeroto521/my-data-toolkit/pull/543/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Zero#diff-ZHRvb2xraXQvYWNjZXNzb3IvaW5kZXgvdG9fc2V0LnB5) | `100.00% <100.00%> (ø)` | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/Zeroto521/my-data-toolkit/pull/543?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Zero).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Zero)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/Zeroto521/my-data-toolkit/pull/543?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Zero). Last update [775b41e...3e4ba6b](https://codecov.io/gh/Zeroto521/my-data-toolkit/pull/543?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Zero). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Zero).


Resolving patch:
diff --git a/dtoolkit/accessor/index/to_set.py b/dtoolkit/accessor/index/to_set.py
--- a/dtoolkit/accessor/index/to_set.py
+++ b/dtoolkit/accessor/index/to_set.py
@@ -21,6 +21,7 @@ def to_set(index: pd.Index) -> set:
     See Also
     --------
     pandas.Index.unique
+    dtoolkit.accessor.series.to_set
 
     Examples
     --------
diff --git a/dtoolkit/accessor/series/to_set.py b/dtoolkit/accessor/series/to_set.py
--- a/dtoolkit/accessor/series/to_set.py
+++ b/dtoolkit/accessor/series/to_set.py
@@ -21,6 +21,7 @@ def to_set(s: pd.Series) -> set:
     See Also
     --------
     pandas.Series.unique
+    dtoolkit.accessor.index.to_set
 
     Examples
     --------
@@ -36,4 +37,4 @@ def to_set(s: pd.Series) -> set:
     {1, 2}
     """
 
-    return set(s.unique())
+    return set(s.to_list())


Test patch: