Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Anonymous
Not applicable

Python Visual with categorical variables

Hi,

I was trying to build an user interactive python visual with categorical variable sliders.  I used a custom filter OKViz to create a slide, however, my python script does not seem to take the categorical values as inputs into my function. For example, my function takes the input fn(price, age, location) as fn(2, 23, 'ON'). When I add the categorical slider, I changed it to fn(2, 23, dataset['location']), and this gives me an error saying "series objects are mutable". 

 

I have read a post doing the same thing with R script and the creator used as.factor(categorical variable), but the equivalent astype('categorical') in python does not seem to work either. 

 

Please help me if you have any idea. Thank you so much.

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

HI @Anonymous ,

I'd like to suggest you to take a look at following link about same issues:

“Series objects are mutable and cannot be hashed” error

Regards,

Xiaoxin Sheng

View solution in original post

1 REPLY 1
Anonymous
Not applicable

HI @Anonymous ,

I'd like to suggest you to take a look at following link about same issues:

“Series objects are mutable and cannot be hashed” error

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.