I'm new to Pandas and Data frames and all of this and I've been trying to generate some charts (pie charts to be exact) with data that is already in an Excel file.
I have one worksheet which contains a big chunk of data. From that worksheet, using openpyxl I'm generating a new worksheet where I add some formulas to return some values looking like this:
https://i.sstatic.net/ojM2R.png
Contents here as well:
+----------------------------------------------------+
| User | Total | Open | Closed | Fixed |Rejected |
+----------------------------------------------------+
| James 23 7 16 7 12 |
| Michael 2 1 1 1 0 |
| Andreas 11 7 4 3 3 |
| Betty 6 2 4 1 3 |
+----------------------------------------------------+
What I want to do now is generate a pie chart with Users and each of the other columns (one pie chart User X Total Tickets, one pie chart with User X Open Tickets and so on)
I've tried xlsxwritter but it overwrites my whole document and didn't manage to have it working. All of the examples with openpyxl which won't overwrite my document contain randomly generated data, not already existing data from and Excel file, and I don't know how to implement those methods with what I want to do.
Can you please help me understand what I should do and maybe how?
I was also wondering if the is a way, like a formula, to generate a pie chart. Something like
(=PIECHART(Sheet!B1:B5,Sheet!C1:C5))
.
Thanks a bunch, Cheers, Alin
IIUC,
df.set_index('User').T.plot.pie(subplots=True, figsize=(15,10), layout=(2,2))
plt.tight_layout()
Output:
df.set_index('User').plot.pie(subplots=True, figsize=(15,10), layout=(2,3))
plt.tight_layout()