title: Is there any solution to load txt file in to LinearRegression() in Python and calculate average values of predict by mean()?
body: <p>I'm using pandas to load data from txt file. Can someone tell me what is wrong with my code?</p>
  <pre><code>import sklearn.linear_model
  
  wineQuality = pd.read_csv('winequality-all.txt', sep=&quot;,&quot;)
  
  X = wineQuality.loc[:,(&quot;fixed.acidity&quot;,&quot;volatile.acidity&quot;,&quot;citric.acid&quot;,&quot;residual.sugar&quot;,&quot;chlorides&quot;,&quot;free.sulfur.dioxide&quot;,&quot;total.sulfur.dioxide&quot;,&quot;density&quot;,&quot;pH&quot;,&quot;sulphates&quot;,&quot;alcohol&quot;,&quot;color&quot;)]
  y = wineQuality.loc[:,('response')]
  X = X.drop(['color'], axis=1)
  X = X.to_numpy();
  y = y.to_numpy();
  print(X)
  print(y)
  print(X.shape)
  print(y.shape)
  np.matmul(X,y);
  mnk = sklearn.linear_model.LinearRegression().fit(X, y)
  print('Score :',mnk.score(X,y))
  print('Avg values :',mnk.predict(X.mean().reshape(1, -1)))
  </code></pre>
  <p>My winequality-all.txt file looks like this:</p>
  <pre><code>&quot;fixed.acidity&quot;,&quot;volatile.acidity&quot;,&quot;citric.acid&quot;,&quot;residual.sugar&quot;,&quot;chlorides&quot;,&quot;free.sulfur.dioxide&quot;,&quot;total.sulfur.dioxide&quot;,&quot;density&quot;,&quot;pH&quot;,&quot;sulphates&quot;,&quot;alcohol&quot;,&quot;response&quot;,&quot;color&quot;
  7.4,0.7,0,1.9,0.076,11,34,0.9978,3.51,0.56,9.4,3,&quot;red&quot;
  7.8,0.88,0,2.6,0.098,25,67,0.9968,3.2,0.68,9.8,3,&quot;red&quot;
  7.8,0.76,0.04,2.3,0.092,15,54,0.997,3.26,0.65,9.8,3,&quot;red&quot;
  ...
  </code></pre>
  <p>I was trying to use methods like reshape(-1,1) or (1,-1) on my X and y - didn't work for me.</p>
  <p>Output:</p>
  <ul>
  <li>[[ 7.4   0.7   0.   ...  3.51  0.56  9.4 ]  [ 7.8   0.88  0.   ...
  3.2   0.68  9.8 ]  [ 7.8   0.76  0.04 ...  3.26  0.65  9.8 ]  ...  [ 6.5   0.24  0.19 ...  2.99  0.46  9.4 ]  [ 5.5   0.29  0.3  ...  3.34  0.38 12.8 ]  [ 6.    0.21  0.38 ...  3.26  0.32 11.8 ]]</li>
  <li>[3 3 3 ... 4 5 4]</li>
  <li>(5320, 11)</li>
  <li>(5320,)</li>
  </ul>
  <p>My error:</p>
  <pre><code>ValueError: matmul: Input operand 1 has a mismatch in its core dimension 0, with gufunc signature (n?,k),(k,m?)-&gt;(n?,m?) (size 5320 is different from 11)
  </code></pre>