Filter csv files based on values

Can I filter csv files based on values and display result ?


Since Streamlit is just a Python library, you can use the full power of any other Python libraries in your Streamlit apps.

For instance, here’s an example of how to use Streamlit with Pandas to load and filter a CSV file:

import streamlit as st
import pandas as pd

def get_data():
    return pd.read_csv('')

'# World GDP'

df = get_data()

min_year = int(df['Year'].min())
max_year = int(df['Year'].max())

countries = df['Country Name'].unique()

'## By country'
country = st.selectbox('Country', countries)
df[df['Country Name'] == country]

'## By year'
year = st.slider('Year', min_year, max_year)
df[df['Year'] == year]

If you want to try out the code above without copying it into a file, just run this command on your terminal:

streamlit run

Awesome ! Another quick question how do we display images say that there is a path mentioned in the filtered list and I want to display 1 image at a time say the returned images is 1000. Is there a widget for the same where I can click next or something and it will display images one by one ?

Hi @yshvrdhn: I know that you know this, but for other users coming in, this thread provides various solutions to this pagination question. Thanks for all the questions!