Add source example files

This commit is contained in:
2025-07-12 18:43:56 +02:00
parent 11d6846f49
commit d0bcfcf8f1
62 changed files with 40101 additions and 161 deletions

View File

@ -0,0 +1,22 @@
import pandas as pd
# Create a Pandas dataframe from the data.
df = pd.DataFrame([10, 20, 30, 20, 15, 30, 45])
# Create a Pandas Excel writer using XlsxWriter as the engine.
writer = pd.ExcelWriter('chart-demo.xlsx', engine='xlsxwriter')
df.to_excel(writer, sheet_name='Sheet1')
# Close the Pandas Excel writer and output the Excel file.
# Get the workbook for the writer
workbook: pd.ExcelWriter = writer.book
worksheet = writer.sheets['Sheet1']
chart = workbook.add_chart({"type": "column"})
# Configure the series of the chart from the dataframe data.
chart.add_series({'values': '=Sheet1!$B$2:$B$8'})
# Insert the chart into the worksheet.
worksheet.insert_chart('D2', chart)
writer.close()