Stefanpt
Stefanpt

Reputation: 77

Pandas extract error: "Columns must be same length as key"

Im using Pandas to extract a sub-string from a column in a excel sheet The regex has been tested multiple ways and does work Error below:

Error given in shell

Says its found a match but get the same error over and over again

enter image description here

Whats happening

Upvotes: 0

Views: 170

Answers (1)

alparslan mimaroğlu
alparslan mimaroğlu

Reputation: 1480

You are probably capturing more than 1 group and all of those are returning another column. You can't assign multiple columns into a single column. Capture a single group with your regex or concatenate your result to your original dataframe. Don't assign it to a single column

Upvotes: 1

Related Questions