title: why ValueError: non-broadcastable output operand with shape (1573,1) doesn't match the broadcast shape (1573,2)?
body: <p>This is my code</p>
  <pre><code>import pandas as pd
  import numpy as np
  from tqdm import tqdm
  import os,time
  import gc
  import re
  from sklearn.ensemble import RandomForestClassifier
  from sklearn.model_selection import train_test_split
  from sklearn.metrics import accuracy_score
  from sklearn.preprocessing import MinMaxScaler
  
  def convert_dtype(x):
      if not x:
          return ''
      try:
          return str(x)   
      except:        
          return ''
  
  def convert_int(x):
      if not x:
          return -1
      try:
          return int(x)
      except:
          try:
              return int(float(x))
          except:
              return -1
  
  def convert_list(x):
      return eval(x)
  
  def LoadData(filename):
      datatype = {
      #'uid' : convert_dtype,
      #'sourceIP_new': convert_dtype,
      #'destinationIP_new': convert_dtype,
      'sourcePort': convert_int,
      'destinationPort': convert_int,
      #'protocol': convert_int,
      'directionType': convert_int,
      'jumboPayloadFlag': convert_int,
      'packetSize': convert_int,
      #'detectName_md5': convert_dtype,
      #'attackType': convert_int,
      #'detectStart': convert_dtype,
      #'detectEnd': convert_dtype,
      #'orgIDX': convert_int,
      'eventCount': convert_int,
      'payload': convert_dtype,
      'normalized_bd': convert_list,
      'notasciistr' : convert_int,
      'length': convert_int,
      'analyResult': convert_int,
      }
      data = pd.read_csv(filename,sep=',',encoding = 'utf-8', converters=datatype,on_bad_lines='warn')
      return data
  
  def LearningModel():
      savepath = 'C:\\Users\\admin\\Desktop\\TASK\\'
      datalist = os.listdir(savepath+'testlearning')
      scaler = MinMaxScaler()
      #bar = tqdm(total=len(datalist),position=0)
      rfc = RandomForestClassifier(n_estimators=10, random_state=2022, warm_start=True)
      
      x_test = []
      y_test = []
      errorlog = []
      train_predict = []
      for file in datalist[3:]:
  
          print(file)
          f = '\\'.join([savepath+'feature',file])
          df = LoadData(f)
          normalized_bd = []
  
          X = df[['sourcePort', 'destinationPort' ,
                    'directionType' ,'jumboPayloadFlag' ,
                    'packetSize' ,'eventCount', 
                    'notasciistr','length']].values.tolist()
          np_nbd = df['normalized_bd']
          X_ =[]
          
          for (i,j) in zip(X,np_nbd):
              X_.append(i+j)
  
          X = np.array(X_)
   
          Y = df['analyResult']
         
    
          try:
              x_train, mini_x_test, y_train, mini_y_test = train_test_split(X,Y,test_size = 0.1, shuffle = True, stratify = Y, random_state=2022)
          except:
              x_train, mini_x_test, y_train, mini_y_test = train_test_split(X,Y,test_size = 0.1, shuffle = True, random_state=2022)
          
          rfc.fit(x_train,y_train)
          rfc.n_estimators += 1
          
  
          y_pred = rfc.predict(x_train)
          train_predict.append(accuracy_score(y_true = y_train, y_pred = y_pred))
  
          x_test += mini_x_test.tolist()
          y_test += mini_y_test.tolist()
  
  
          #bar.update()
          
      #bar.close()
      
      return rfc,x_test,y_test,train_predict
  
  def PredictModel(rfc,x_test,y_test):
      print('learning!')
      y_pred = rfc.predict(x_test)
      acc = accuracy_score(y_true = np.array(y_test), y_pred = y_pred)
      print('Test set')
      print(f&quot;정확도(accuracy):{acc:0.4f}&quot;)
  
  
  if __name__ == '__main__':
      rfc,x_test,y_test,train_predict = LearningModel()
      print(train_predict)
      PredictModel(rfc,x_test,y_test)
  </code></pre>
  <p>#error log</p>
  <pre><code>File ~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\sklearn\ensemble\_forest.py:667, in _accumulate_prediction(predict, X, out, lock)
      665 with lock:
      666     if len(out) == 1:
  --&gt; 667         out[0] += prediction
      668     else:
      669         for i in range(len(out)):
  
  ValueError: non-broadcastable output operand with shape (1573,1) doesn't match the broadcast shape (1573,2)
  </code></pre>
  <p>#X -&gt; 264 numpy array , y -&gt; label
  #x_test[0]</p>
  <pre><code>[60006.0, 80.0, 1.0, 0.0, 289.0, 1.0, 0.0, 235.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0425531914893617, 0.0, 0.0, 0.0425531914893617, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.05106382978723404, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.00425531914893617, 0.00425531914893617, 0.00851063829787234, 0.0, 0.0, 0.02553191489361702, 0.02553191489361702, 0.02553191489361702, 0.01702127659574468, 0.01276595744680851, 0.00851063829787234, 0.0, 0.01702127659574468, 0.00425531914893617, 0.00851063829787234, 0.0, 0.00851063829787234, 0.00851063829787234, 0.03404255319148936, 0.00425531914893617, 0.0, 0.0, 0.0, 0.0, 0.0, 0.01276595744680851, 0.0, 0.02553191489361702, 0.0, 0.00851063829787234, 0.00851063829787234, 0.0, 0.00851063829787234, 0.00425531914893617, 0.0, 0.00425531914893617, 0.00425531914893617, 0.00425531914893617, 0.0, 0.00425531914893617, 0.00851063829787234, 0.0, 0.0, 0.00425531914893617, 0.01702127659574468, 0.00425531914893617, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.02553191489361702, 0.00425531914893617, 0.029787234042553193, 0.00425531914893617, 0.06808510638297872, 0.00851063829787234, 0.01276595744680851, 0.01276595744680851, 0.02553191489361702, 0.0, 0.0, 0.01702127659574468, 0.00851063829787234, 0.08936170212765958, 0.059574468085106386, 0.02553191489361702, 0.0, 0.02553191489361702, 0.02127659574468085, 0.07234042553191489, 0.0, 0.0, 0.0, 0.0, 0.01276595744680851, 0.00425531914893617, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,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1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1]
  </code></pre>
  <p>X length is same Y length</p>
  <p>when I execute code with just one file(causing problem) it works well. but execute with all file make error.
  Please Help me.</p>