Hi Oleksandr,
I am using DynamicFilters. I am getting “Row index out of range” error in Devtools. I copied the DynamicFilters code into a separate file and ran it. I still get the errors.
The error messages appear when I start filtering using the multiselect boxes.
As I select additional filters, I get more errors. These errors are only seen in Devtools. The app works fine. There are 7089 rows in the dataframe.
Row index out of range: 7089 (listed 9 times)
Row index out of range: 2 (listed 9 times)
Row index out of range: 3 (listed 9 times)
Row index out of range: 4 (listed 9 times)
…
Row index out of range: 4136 (listed 9 times)
Isolated code:
import streamlit as st
import pandas as pd
import altair as alt
from streamlit_dynamic_filters import DynamicFilters
import warnings
warnings.filterwarnings(‘ignore’)
@st.cache_data
def load_data():
data = pd.read_csv(“US_Breweries.csv”)
data[‘postal_code’] = data[‘postal_code’].str.slice(0,5)
data = data[[‘name’,‘brewery_type’,‘address_1’,‘city’,‘state’,‘postal_code’,‘phone’,‘website_url’]].copy()
return data
df = load_data()
selected_breweries = df.copy()
st.write(“Apply filters:”)
dynamic_filters = DynamicFilters(selected_breweries, filters=[‘state’, ‘city’, ‘brewery_type’, ‘postal_code’, ‘name’], filters_name = ‘filters1’)
dynamic_filters.display_filters(location=‘columns’, num_columns=2, gap=‘large’)
selected_breweries = dynamic_filters.filter_df()
st.write(“”)
st.write(“”)
with st.expander(“Data Preview”):
st.write(“Hover over column name to display icons on the right for download, search, fullscreen”)
st.write(“Click columns names to sort”)
dynamic_filters.display_df()
st.write(“”)
Thanks