Skip to content
This repository has been archived by the owner on May 3, 2020. It is now read-only.

Integration with ipywidgets #24

Open
parallelko opened this issue Sep 25, 2019 · 3 comments
Open

Integration with ipywidgets #24

parallelko opened this issue Sep 25, 2019 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@parallelko
Copy link

Is your feature request related to a problem? Please describe.
I am dynamically changing DataFrame with function in ipywidgets, and i really loved your datatables. But it could't work together.
Is it possible to do something that it could work together?

@parallelko parallelko added the enhancement New feature or request label Sep 25, 2019
@CermakM
Copy link
Owner

CermakM commented Sep 27, 2019

Hello @parallelko, please provide a reproducible example or the whole notebook so that I could look into the issue.

Cheers,
M

@parallelko
Copy link
Author

Here is just simple example:

import warnings
warnings.filterwarnings('ignore')
import pandas as pd
from ipywidgets import interact
from jupyter_datatables import init_datatables_mode
init_datatables_mode() #jupyter_datatables improvements

d = {'department': [1, 2, 1, 2, 1, 2], 'name': ['Anton', 'Bob', 'Alice', 'Ivan', 'Jack', 'Jess'], 'Salary': [1000, 900, 2000, 1500, 800, 1100]}
df = pd.DataFrame(data=d)

def foo(DEP):
    showDF = df[(df['department'] == DEP)]
    num = showDF.sum(axis = 0, skipna = True)['Salary']
    showDF['RATIO'] = round(showDF['Salary']/num*100,1)
    return showDF.sort_values(by=['Salary'],ascending = False)

interact(foo,
         DEP = list(df['department'].unique()),
         );

@CermakM
Copy link
Owner

CermakM commented Oct 1, 2019

Hello! Ah, I can see the problem now, you want the data tables to actually reflect the dynamic changes. Gotcha! This is pretty interesting and I'll see what I can do.

Stay tuned.

Cheers,
Marek

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants