Python Jupyter Notebook Interactive Spreadsheets with ipysheet

Опубликовано: 12 Октябрь 2024
на канале: Ryan Noonan
5,454
57

In this python tutorial, we will go over how to create interactive spreadsheets within the Jupyter Notebook environment. Topics include: create basic table / spreadsheet, add values to spreadsheet, convert pandas dataframe to spreadsheet, perform calculations, link cells to widgets using ipywidgets, conditional formatting.

Jupyter Notebook on GitHub: https://github.com/groundhogday321/py...

extra example added after tutorial
apply function to many cells

import ipysheet

create sheet
sheet = ipysheet.sheet(rows=5, columns=5)

fill column with values
numbers = [1, 2, 3, 4, 5]
column = ipysheet.column(column=0, value=numbers, row_start=0)

square function
def square(number):
return number*number

column B is square of column A
for index,number in enumerate(numbers):
ipysheet.cell(row=index, column=1, value=square(number=number))

add 10 function
def add_ten(number):
return number+10

column C is column A + 10
for index,number in enumerate(numbers):
ipysheet.cell(row=index, column=2, value=add_ten(number=number))

display sheet
sheet