Simple question about Python

Hello everyone,

I have a simple question. I was reading this code when something completely unrelated came up into my head:

df = pd.read_csv(“results.csv”)
ax = plt.subplot()
plt.bar(range(len(df)),
df[“Mean Satisfaction”])
ax.set_xticks(range(len(df)))
ax.set_xticklabels(df.Gender)
plt.xlabel(“Gender”)
plt.ylabel(“Mean Satisfaction”)

What is the difference between calling a df row in this way:

df[“Mean Satisfaction”]

and this way:

df.Gender

I believe what you are referring to are Columns and not the row.
And I think there is no much difference. However sometimes calling the columns by would be good if there is any space contain in the header of the columns.

1 Like

Yes, my bad. I meant columns. Thanks for the answer really helpful!