Get filtered data from Perspective


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': [( + timedelta(days=i)).date() for i in range(9)],
    'datetime': [( + 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': ['', '', '']*3,
df = pd.DataFrame(data)

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

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

Kind regards

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