Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
type error array
#1
I have a numpy 2darray called d5. I'm trying to get values from row#1 [0]. and I'm comparing them with values from row#2 [1]. If values from row#2 are not equal, then advance to row#3 and iterate until you find a match. Here is the code that is throwing an error for me, along with the error message it self. Bare with me cause i'm really a newbie, and there may be ALOT wrong with what I'm doing!
    lay_1 = 1
    a = 0
    b = lay_1
    del5_counter = 0
    draw_del5 = np.array(d5[a][1] - d5[a][0], d5[a][2] - d5[a][1], d5[a][3] - d5[a][2], d5[a][4] - d5[a][3])
    for row in d5:
        del5_1 = np.array(d5[b][1] - d5[b][0], d5[b][2] - d5[b][1], d5[b][3] - d5[b][2], d5[b][4] - d5[b][3])
        if del5_1 != draw_del5:
            b += 1
            del5_counter += 1
        else:
            break


Traceback (most recent call last):
  File "C:\Users\Brian\MyPythonScripts\working.py", line 177, in <module>
    draw_del5 = np.array(d5[a][1] - d5[a][0], d5[a][2] - d5[a][1], d5[a][3] - d5[a][2], d5[a][4] - d5[a][3])
TypeError: array() takes from 1 to 2 positional arguments but 4 were given
Reply


Messages In This Thread
type error array - by BrianPA - Jan-17-2021, 02:01 AM
RE: type error array - by deanhystad - Jan-17-2021, 03:00 AM
RE: type error array - by BrianPA - Jan-17-2021, 01:48 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [Numpy] How to store different data type in one numpy array? water 7 625 Mar-26-2024, 02:18 PM
Last Post: snippsat
  GroupBy - Sum = Error [datetime64 type does not support sum operations] BSDevo 4 2,899 Oct-27-2023, 07:22 PM
Last Post: BSDevo
  Type error in Cross_val_score Vicral 0 1,839 Jul-20-2021, 12:18 PM
Last Post: Vicral
  Error binding parameter 0 - probably unsupported type. illmattic 7 10,398 Jul-18-2020, 09:32 PM
Last Post: illmattic
  How to prepare a NumPy array which include float type array elements subhash 0 1,927 Mar-02-2020, 06:46 AM
Last Post: subhash
  TensorFlow get error - array with more than one element is ambiguous vokoyo 3 5,565 Nov-07-2019, 01:12 PM
Last Post: ThomasL
  Error Message: TypeError: unhashable type: 'set' twinpiques 4 19,005 May-22-2019, 02:31 PM
Last Post: twinpiques
  Error:unsupported operand type(s) for ** or pow(): 'list' and 'int' mcgrim 3 18,371 Mar-22-2019, 01:29 PM
Last Post: buran
  python odeint keeps giving me size of array error kiyoshi7 1 6,166 Nov-01-2018, 02:03 AM
Last Post: j.crater
  Type Error Confusion Oliver 4 14,504 Dec-06-2017, 03:20 PM
Last Post: Oliver

Forum Jump:

User Panel Messages

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