0

I'm trying to put label an axis, and I seem to be getting an error. I want to call the names of the strings I set earlier in the code.

ticker = 'RY', 'CM' 

Then later on I call the names when naming the graph.

plt.ylabel('Price Spread between %s and %s') % (ticker[0], ticker[1])

But, I get this error:

TypeError: unsupported operand type(s) for %: 'Text' and 'tuple'

What am I doing wrong here?

1 Answer 1

2

Change the formatting line present on your code to,

plt.ylabel('Price Spread between %s and %s' % (ticker[0], ticker[1]))
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks. That was me just not seeing the obvious.
This also works plt.ylabel('Price Spread between %s and %s' % ticker)?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.