Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from sys import stdin
- import xlsxwriter
- def diagram():
- prices = [[words.strip().split()[0], int(words.strip().split()[1])] for words in stdin]
- prices = [
- [x[0] for x in prices],
- [x[1] for x in prices]]
- workbook = xlsxwriter.Workbook('res.xlsx')
- worksheet = workbook.add_worksheet()
- worksheet.write_column('A1', prices[0])
- worksheet.write_column('B1', prices[1])
- chart = workbook.add_chart({'type': 'pie'})
- chart.add_series({
- 'values': ['Sheet1', 0, 1, len(prices[0]) - 1, 1],
- 'categories': ['Sheet1', 0, 0, len(prices[0]) - 1, 0],
- 'data_labels': {'percentage': True},
- })
- worksheet.insert_chart('C3', chart)
- workbook.close()
- diagram()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement