Enable many complex number tests
State: closed

These changes put complex128 on an even footing with float64 and int64 as far as numerical testing is concerned.  These changes have been tested both against the Pandas test suite as well as the Pint-Pandas testsuite (using complex magnitudes).

These changes are a simpler version of a previous pull-request that was destroyed by GitHub's fork synchronize behavior.

- [ ] closes #xxxx (Replace xxxx with the GitHub issue number)
- [x] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [x] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [x] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [x] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.


Labels:
name: Complex
description: Complex Numbers
name: Stale

Comments:
False alarm: these simplified changes DO work with uncertainties in Pint...when used with the version of Pint that also supports uncertainties.  :blush:
Tests with uncertainties all pass (with similar `request`-related changes).  I cannot commit those changes to Pint-Pandas until these changes are accepted.  It is very nice that the underlying changes made to Pandas 2.1 really simplifies the Pint-Pandas uses of EAs.

@andrewgsavage @hgrecco
@mroeschke can you have a look at this and let me know if any additional changes are needed?
I strongly suspect the mypy failure was due to unrelated issues in CI/CD.  In the intervening weeks, things have moved forward.  Is it preferred practice to update via merge or rebase to catch up to latest after sitting idle for 3 weeks?
Merging in main is sufficient. History is squashed during merging into main
Fixed mypy issues I did not previously understand, and caught a new bug introduced by #55255.  Accepting these changes might catch more bugs related to complex128 in the future ;-)
I am mystified by the failure in `Unit Tests / ubuntu-latest actions-39.yaml`  I have attempted to recreate on my own machine using act, Docker, and my own repo and the `test_unique_bad_unicode` test cases pass.  They fail only in this one case, succeeding in ubuntu 3.10, 3.11, macos everywhere, windows everywhere, python-dev, etc.  Any tips on how to diagnose are welcome.  Also mystifying: nobody else is hitting this problem in their Unit tests.  Nor does this test go through any of the code I have modified (that I can see).  A Heisenbug?
One possible reason I cannot reproduce is because Pandas CI/CD Docker is running Linux 6.2.0 on Azure and the Docker I am running uses Linux 6.4.16-linuxkit on OSX.  I have tried other versions of Docker Desktop that have kernels like `5.15.49-linuxkit-pr` and `6.3.13-linuxkit` but neither of these reproduce the problem.
This pull request is stale because it has been open for thirty days with no activity. Please [update](https://pandas.pydata.org/pandas-docs/stable/development/contributing.html#updating-your-pull-request) and respond to this comment if you're still interested in working on this.
Thanks to some upstream changes, the changes required to support many complex test cases is greatly simplified.  Please let me know your feedback on these changes.
Can somebody remove the stale tag from this PR?
> This pull request is stale because it has been open for thirty days with no activity. Please [update](https://pandas.pydata.org/pandas-docs/stable/development/contributing.html#updating-your-pull-request) and respond to this comment if you're still interested in working on this.

I have updated this PR.
Note that the only failure now is Numpy Dev (and most likely "not my fault").
The new 3.0.0 build rules make these changes happy.  Previous build rules across a variety of merge points in the 2.2.x created problems with inconsistent parameters unrelated to these changes.  Perhaps this is now ready to merge?
Looks like this PR as gone stale so closing to clear the queue, if interested in contributing please merge in main and we can reopen
Twice I've tried to get this merged, and twice it's gone stale.  I thought it was a good idea, and I'm willing to try again, but only if there's enough interest on the Pandas side to make complex128 a first-class test case.