-2

How can I select a specific cell in this dataframe?, the index in this data frame is the Fishes column.
My expected output is: e.g
> 35045.12
or anything in the production column. Thanks a lot!

Fishes                 | Month | Year | production
BF - Milkfish          |   3   | 2019 | 35045.12
BF - Tilapia           |   6   | 2019 | 68666.64
BF - Tiger prawn       |   9   | 2019 | 77064.91
BF - Mudcrab           |   12  | 2019 | 58163.4
BF - Endeavor prawn    |   3   | 2020 | 38108.49
BF - White shrimp      |   6   | 2020 | 67663.83
BF - Grouper           |   9   | 2020 | 71316.94
love
  • 3
  • 2

2 Answers2

0
print(df.loc['BF - Milkfish', 'production'])
# or
print(df['production'].iloc[0])
35045.12
Ynjxsjmh
  • 28,441
  • 6
  • 34
  • 52
0

There are several ways to get the answer you are looking for, this is simply another way if you wanted to add to your bag of tricks

df['production'].loc[df['Fishes'] == 'BF - Milkfish'].squeeze()
ArchAngelPwn
  • 2,891
  • 1
  • 4
  • 17