File size: 883 Bytes
13ce491
 
 
 
fb157f4
 
 
 
 
 
 
 
 
 
 
13ce491
 
 
 
 
 
 
 
 
 
 
 
 
fb157f4
 
13ce491
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import os
import pandas as pd
import streamlit as st

def download_dataset():
    # Ensure the data directory exists
    if not os.path.exists('./data'):
        os.makedirs('./data')

    # Download the dataset using Kaggle API
    os.system("kaggle datasets download -d mohaideenabuthahir/analyzeyt -p ./data --unzip")

def load_data():
    # Ensure dataset is downloaded
    download_dataset()

    # List available files in the data directory
    available_files = [f for f in os.listdir('./data') if f.endswith('.csv')]

    # Ask user to select which file to load
    selected_file = st.selectbox('Select a file to load', available_files)

    # Load the selected dataset
    data = pd.read_csv(f'./data/{selected_file}')
    return data

def main():
    st.title("Kaggle Dataset Loader")
    data = load_data()
    st.write(data.head())

if __name__ == "__main__":
    main()