0

All,

I have a df that looks like this

     lib1m   markdate     tag  purpose currencyBench
0 -0.08900 2018-03-01   LIBOR  REUTERS           JPY
1  0.49663 2018-03-01   LIBOR  REUTERS           GBP
2 -0.59900 2018-03-01  STIBOR  REUTERS           SEK
3 -0.37100 2018-03-01   LIBOR     ECON           EUR
4  1.42000 2018-03-01  OBFR01    ECON5           USD

To access the number i am looking for i did this:

rates.loc[(rates['currencyBench']=='GBP') ,['lib1m']]

However, the output is

     lib1m
1  0.49663

but what I am looking for is 0.49663 without column name and the index.

Any idea is more than welcome

Thanks

Nick ODell
  • 15,465
  • 3
  • 32
  • 66
SBad
  • 1,245
  • 5
  • 23
  • 36

1 Answers1

1

Use rates.loc[rates['currencyBench']=='GBP', 'lib1m'].iloc[0].

pd.DataFrame.iloc is used for integer indexing.

In this case, indexing with 0 will extract the first element of your pd.Series.

jpp
  • 159,742
  • 34
  • 281
  • 339