Related question

Screen Link:

My Code:

medians = f500[["profits"]].median(axis=1)

print(medians)


AND

medians = f500[["profits", "revenues"]].median(axis=1)

print(medians)

What I expected to happen:
I was just playing around and switched index from 0 to 1
What is actually happening here? What are we summing over. Why are the codes different? What is happening>

What actually happened:

Replace this line with the output/error

I tried this in my browser and it’s working fine.

Well, it"s explained in the screenshot you posted.

  • axis = 0: calculates along column axis
  • axis = 1: calculates along row axis