Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

row/column remove #182

Open
xiaoyangegege opened this issue Dec 18, 2020 · 1 comment
Open

row/column remove #182

xiaoyangegege opened this issue Dec 18, 2020 · 1 comment

Comments

@xiaoyangegege
Copy link

how to remove a row/column if you know the row number or after you select a row/column

@jgunstone
Copy link

i've been struggling with this also...
i made a simple widget that allows the user of a voila app to add and remove rows, but for some reason if I try and remove more rows than i began with it breaks.

see Gist for semi-working code:
https://gist.github.com/gunstonej/1817c25e7c1421ec76c95d80d782b82c

it would be great to know if this is possible!

this code demonstrates the issue:

# %%
import pandas as pd
import ipysheet

def debugsheet(sheet):
    
    def debugcells(cell):
        print('cell.value = {}'.format(str(cell.value)))  
        print('cell.row_start = {}'.format(str(cell.row_start)))
        print('cell.row_end = {}'.format(str(cell.row_end)))
        print('cell.row_end - col.row_start + 1 = {}'.format(str(cell.row_end - cell.row_start + 1)))
        print('len(cell.value) = {}'.format(len(cell.value)))
        
    print('sheet.rows = {}'.format(str(sheet.rows)))    
    [debugcells(cell) for cell in sheet.cells];

df = pd.DataFrame.from_dict({'a':[0,1,2],'b':[1,2,3]})
sheet = ipysheet.from_dataframe(df)
sheet

# %%
sheet.rows -=1

# %%
debugsheet(sheet)

# %%
ipysheet.to_dataframe(sheet)  # ERROR

jgunstone added a commit to maxfordham/ipyrun that referenced this issue Apr 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants