Home » python » Page 3

python

Solving “set_params() takes 1 positional argument but 2 were given”

  • by
  • 2 min read

Brief blog post on a silly Python error. I’m still working on my ML project started hypertuning my sklearn pipeline — manually. To set the parameters of my pipeline in every iteration, I had to use set_params. My estimator is called model_pipeline and I needed to set the parameters via… 

Pandas: Solve ‘You are trying to merge on object and float64 columns’

  • by
  • 2 min read

Pandas can be somewhat puzzling, sometimes. It has a ton load of functionalities, but that can make the syntax and methods obscure. Simply judging from the method name, the ‘join’ and ‘merge’ method could be the same thing. However, they aren’t. Here’s an error that I used to run into… 

Solve “columns overlap but no suffix specified” in Pandas

  • by
  • 2 min read

Surprisingly, the Pandas error “columns overlap but no suffix specified”, is one I ran into surprisingly late. Solving it is usually very straightforward. We’ll tackle it in this blog post. First, let’s take a closer look at the error: “ValueError: columns overlap but no suffix specified: Index([<list of columns>], dtype=’object’)”… 

Solving “Found unknown categories […] in column” with sklearn OneHotEncoder

In this short blog post, I tackle an error related to a classic problem within machine learning: how to treat unseen categorical values and solve the “found unknown categories” error. Imagine you have a train and a test data set with the following values in a column: Train: [‘green’, ‘red’,…