title: AttributeError: 'str' object has no attribute 'decode' while building a logistic regression model
body: <p>I am trying to build a logistic regression model but it shows an <code>AttributeError: 'str' object has no attribute 'decode'</code>. please help me fix this. This code ran perfectly on Datacamp's server but its showing an AttributeError on my Laptop.</p>
  <pre><code>import pandas as pd
  df = pd.read_csv('datasets/diabetes.csv')
  X = df.drop('diabetes',axis = 1)
  y = df['diabetes']
  
  # Import the necessary modules
  from sklearn.linear_model import LogisticRegression
  from sklearn.metrics import classification_report, confusion_matrix
  
  # Create training and test sets
  X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.4, random_state=42)
  
  # Create the classifier: logreg
  logreg = LogisticRegression()
  
  # Fit the classifier to the training data
  logreg.fit(X_train,y_train)
  </code></pre>
  <p>Error Message:</p>
  <pre><code>---------------------------------------------------------------------------
  AttributeError                            Traceback (most recent call last)
  &lt;ipython-input-8-c8cf98ee145a&gt; in &lt;module&gt;
       16 
       17 # Fit the classifier to the training data
  ---&gt; 18 logreg.fit(X_train,y_train)
       19 
       20 #Predict the labels of the test set: y_pred
  
  ~\anaconda3\envs\tensorflow\lib\site-packages\sklearn\linear_model\_logistic.py in fit(self, X, y, 
  sample_weight)
     1405         else:
     1406             prefer = 'processes'
  -&gt; 1407         fold_coefs_ = Parallel(n_jobs=self.n_jobs, verbose=self.verbose,
     1408                                **_joblib_parallel_args(prefer=prefer))(
     1409             path_func(X, y, pos_class=class_, Cs=[C_],
  
  
  ~\anaconda3\envs\tensorflow\lib\site-packages\sklearn\utils\optimize.py in 
  _check_optimize_result(solver, result, max_iter, extra_warning_msg)
      241                 &quot;    https://scikit-learn.org/stable/modules/&quot;
      242                 &quot;preprocessing.html&quot;
  --&gt; 243             ).format(solver, result.status, result.message.decode(&quot;latin1&quot;))
      244             if extra_warning_msg is not None:
      245                 warning_msg += &quot;\n&quot; + extra_warning_msg
  
   AttributeError: 'str' object has no attribute 'decode'
  </code></pre>
  <p>Any suggestions would be appreciated</p>