0

I am trying to make a simple scheduler with pandas datafram. When calling the pandas.loc function for a specific element in the dataframe it outputs the element with the index.

df.loc[df['days'] == 'tuesday','task']

This is the output

'0    Go for a run'

As i want to use the output as a string, is there a way to remove the index. Or a different function to use. What i want the output to be is just -

'Go for a run'

1 Answers1

0

As per this answer here maybe try this:

print(df.loc[df['days'] == 'tuesday','task'].to_string(index=False))

Hope it works!

some_programmer
  • 3,268
  • 4
  • 24
  • 59
BrunoSE
  • 94
  • 4