3D Plot Python, add_lines, add_paths

Hi I am looking for a way to replicate some R code in Python. I already looked into the docs but found nothing exactly matching. This is my R code:

p1 <- plot_ly(df, x=~xaxis, y=~yaxis, z=~zaxis)

p1 <- p1 %>% add_markers(size=3)

p1 <- p1 %>% group_by(A) %>% add_paths

p1 <- p1 %>% group_by(B) %>% add_lines

How would I replicate this in Python. I want to do a group operation and then add lines only over the x-axis or the y-axis respectively.

Thank you very much