Skip to content
Advertisement

Plotting barchart in Excel with Python, dynamic categories

I try to get a chart in Excel using Python. The code below works for now but next month a new line will be added. As you can see I now only select until line 64 (categories and values) so if I want to add the next month to the chart, I have to change 64 into 65. Is there a way to automatically add this line next month?

JavaScript

Advertisement

Answer

You could calculate the last row from the df.shape or len() of the data. Like this:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement