Python Forum
IPython errors for numpy array min/max methods
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
IPython errors for numpy array min/max methods
#1
I'm using the IPython console (v 8.12.0) in Anaconda and getting some error messages I don't understand when accessing basic methods of numpy arrays. If I use the same commands in IDLE then I don't get any errors. For example, I enter the following in IPython console and get this:

import numpy as np
a = np.linspace(1,36,36).reshape(12,3)
a.min()
Out: 1.0
Error:
[SpyderKernelApp] ERROR | Exception in message handler: Traceback (most recent call last): File "C:\Users\jody\anaconda3\Lib\site-packages\ipykernel\kernelbase.py", line 406, in dispatch_shell await result File "C:\Users\jody\anaconda3\Lib\site-packages\ipykernel\kernelbase.py", line 796, in inspect_request reply_content = self.do_inspect( ^^^^^^^^^^^^^^^^ File "C:\Users\jody\anaconda3\Lib\site-packages\ipykernel\ipkernel.py", line 544, in do_inspect bundle = self.shell.object_inspect_mime( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\jody\anaconda3\Lib\site-packages\IPython\core\interactiveshell.py", line 1838, in object_inspect_mime return self.inspector._get_info( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\jody\anaconda3\Lib\site-packages\IPython\core\oinspect.py", line 738, in _get_info info_dict = self.info(obj, oname=oname, info=info, detail_level=detail_level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\jody\anaconda3\Lib\site-packages\IPython\core\oinspect.py", line 838, in info if info and info.parent and hasattr(info.parent, HOOK_NAME): ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
Larz60+ write Nov-04-2023, 11:13 AM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
modified for you this time. Please use BBCode tags on future posts.
Reply


Messages In This Thread
IPython errors for numpy array min/max methods - by muelaner - Nov-04-2023, 09:08 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Numpy, array(2d,bool), flipping regions. MvGulik 2 960 Oct-27-2024, 11:06 AM
Last Post: MvGulik
  python code to calculate mean of an array of numbers using numpy viren 3 1,127 May-29-2024, 04:49 PM
Last Post: Gribouillis
  Convert numpy array to image without loading it into RAM. DreamingInsanity 7 8,930 Feb-08-2024, 09:38 AM
Last Post: paul18fr
  Expand the range of a NumPy array? PythonNPC 0 1,707 Jan-31-2023, 02:41 AM
Last Post: PythonNPC
  Change a numpy array to a dataframe Led_Zeppelin 3 2,571 Jan-26-2023, 09:01 PM
Last Post: deanhystad
  from numpy array to csv - rounding SchroedingersLion 6 6,009 Nov-14-2022, 09:09 PM
Last Post: deanhystad
  numpy.array has no attribute head Led_Zeppelin 1 3,114 Jul-13-2022, 12:56 AM
Last Post: Led_Zeppelin
  Seeing al the data in a dataframe or numpy.array Led_Zeppelin 1 1,703 Jul-11-2022, 08:54 PM
Last Post: Larz60+
  go over and search in numpy array faster caro 7 3,194 Jun-20-2022, 04:54 PM
Last Post: deanhystad
  Can a program execute code in iPython shell and get result? deanhystad 3 2,714 Jun-17-2022, 03:45 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020