jeudi 28 octobre 2021

How to add a checkbox in pandas dataframe

I have created a dataframe as:

import pandas as pd
 
data = [['Ankit'], ['Akshat' ]]
 
df = pd.DataFrame(data, columns = ['Name'])

Now, I want to insert a column PPA which has checkbox button as values. So, I have written the code as:

import ipywidgets
checkbox_button=widgets.Checkbox(description="", value=False,indent=False)
df.insert(loc = 0,column = 'PPA',value = checkbox_button)

But after running the code in jupyter notebook, I am getting the column values of column PPA as:
Checkbox(value=False, indent=False) but when I run widgets.Checkbox(description="", value=False,indent=False) in the jupyter notebook, I get the proper checkbox button.

So, Can anyone please tell me how to get the checkbox button in a column of a dataframe ?
Any help would be appreciated.




Aucun commentaire:

Enregistrer un commentaire