0

I would like to refer to paragraph 3 in my question, asking for the role of the word: Value.

Being more explicit, I'm talking about this code line:

print(df[['Gold']][df.Value == df.Value.max()])

Referring the answer I've got,

I'm talking also about the role of the word: Value also in this snippet:

for value in df['Gold']:
    if value>CurrentMax:
        CurrentMax = value

And referring this question, in these code lines:

The following four (separated) code lines, in which it is written: 'Value' (or ['Value']), with CAPITAL V:

data.groupby(['Country','Place'])['Value'].max()

df.loc[df['Value'].idxmax()]

df[df['Value']==df['Value'].max()]

print '%s, %s, %s' % (s['Country'], s['Place'], s['Value'])

In this code line, in which it is written: 'value' (or ['value']), with small v:

df.groupby(['country','place'], as_index=False)['value'].max()

And in this code line, in which it is written between dots and with small letters, without apostrophes:

df.groupby("country").apply(lambda df:df.irow(df.value.argmax()))

An important note:

I'm actually asking SEVERAL QUESTIONS here:

  1. Why are there differences in the way the word Value is written?
  2. Is that word a function? A keyword? An attribute? Something else?
  3. What is the word's role in each piece of code written above?

Just to distinguish, I was looking also at the values() function here,

and also searched the word Value in the Pandas DataFrame Documentation,

to check whether it was an attribute, a method or (maybe) something else.
I didn't find anything in this last document.

Thanks!

Yoel Zajac
  • 453
  • 1
  • 6
  • 11
  • 5
    `Value` is a column in the dataframe. Pandas allows easy access to columns this way. Obviously, this only works for columns that don't share the name with existing dataframe attributes. – 9769953 Dec 07 '18 at 13:48
  • If it's written `value`, then the column is simply named without an initial `V`. – 9769953 Dec 07 '18 at 14:13
  • 1
    https://pandas.pydata.org/pandas-docs/stable/indexing.html#attribute-access – 9769953 Dec 07 '18 at 14:15
  • @9769953 Well, that's (a bit) long... but seems useful at the same time. :-) It may solve a big part of my question, seemingly. Thanks! – Yoel Zajac Dec 07 '18 at 14:22

0 Answers0