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

Debug tuple print of np.float #224

Merged
merged 1 commit into from
Nov 25, 2024
Merged

Debug tuple print of np.float #224

merged 1 commit into from
Nov 25, 2024

Conversation

tbaudier
Copy link
Contributor

Debug #223

With numpy>=2.0.0, tuple(vectors[0]) returns the type of the number (eg: np.float64()) instead of the number.

Adding .tolist() to the vector converts the vector to a python list and could be printed.

Work also with numpy <2.0.0

With numpy>=2.0.0, tuple(vectors[0]) returns the type of the number (eg: np.float64()) instead of the number
Adding .tolist() to the vector converts the vector to a python list and could be printed.
Work also with numpy <2.0.0
@wolph
Copy link
Owner

wolph commented Oct 26, 2024

I'm testing whether this works in both cases. I can't just drop numpy 1.x any time soon :)

Thank you so much for the pull request though! Even if it doesn't work in both cases, I can simply make the test conditional.

@wolph wolph merged commit c7c4683 into wolph:develop Nov 25, 2024
0 of 4 checks passed
@wolph
Copy link
Owner

wolph commented Nov 25, 2024

Long overdue, but it's merged, thank you so much for your help!

@jorenham
Copy link

I suppose it's too late now, but there's also the np.set_printoptions(legacy="1.25") trick:
https://numpy.org/doc/stable/reference/generated/numpy.set_printoptions.html

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.

3 participants