Get filtered data from Perspective

Hi

I am trying to use Perspective as a customized filter. But i dont know have to read the filtered data in Perspective. Any suggest will be greatful.

Please see exmaple code here:

import numpy as np
import random
from datetime import datetime, timedelta
data = {
    'int': [random.randint(-10, 10) for _ in range(9)],
    'float': [random.uniform(-10, 10) for _ in range(9)],
    'date': [(datetime.now() + timedelta(days=i)).date() for i in range(9)],
    'datetime': [(datetime.now() + timedelta(hours=i)) for i in range(9)],
    'category': ['Category A', 'Category B', 'Category C', 'Category A', 'Category B',
             'Category C', 'Category A', 'Category B', 'Category C',],
    'link': ['https://panel.holoviz.org/', 'https://discourse.holoviz.org/', 'https://github.com/holoviz/panel']*3,
}
df = pd.DataFrame(data)

a = pn.pane.Perspective(df, width=1000)
a

i applyed some filter on it, is that possible that read the filtered data from Perspective?

Kind regards
Victor

Hi @CongTang,

Doesn’t look like the filtered result is stored not that I can determine, I guess a long option would be to retrieve the filters and apply it to the original object dataframe

1 Like

Get it Thanks for you information