Adding legends based on a third column and coloring based on a colorscale

Hello all, I am new to plotly. I am using it through python. I am trying to figure out a way to make legend off a third column. For example,
x y Category
5 25 Squared
2 4 Squared
3 27 Cube
4 16 Squared

then, I want a scatter plot of x vs y with legend as category. I group my dataframe based on category and then loop through the different groups but I think there should be a better way to do this.

My try:
go.Scatter(
x=x,
y=y,
mode=โ€˜markersโ€™,
marker=dict(
size=8,
color=my_colorscale,

),
name=Category,
legendgroup=Category,
showlegend=True
)

This does give me different legends but all categories have the first color in my colorscale. So I tried,
go.Scatter(
x=x,
y=y,
mode=โ€˜markersโ€™,
marker=dict(
size=8,
color=np.arange(1,13,1),
colorscale=my_colorscale

),
name=Category,
legendgroup=Category,
showlegend=True
)
but this does nothing. Is there a way to map the colorscale with respect to the category column and then do the same thing as above? Or is there a better way to do this? Can someone please help?

Thanks,
Adi