Import data from CSV files
Load data from CSV and Excel files into Pixeltable tables for processing and analysis.
Updated Open in Colab
Create training, validation, and test splits with random or stratified sampling.
Data Import/Export · Notebook · Updated
Colab runs it in your browser. If it calls a model provider, it asks for that provider's API key in a cell.
You use query.sample() to create random subsets, with optional stratification for balanced class distribution.
pip install pixeltable
pxt.create_table()insert()sample()# Create a dataset with labelsdata = pxt.create_table('sampling_demo/data',{'text': pxt.String, 'label': pxt.String, 'score': pxt.Float},)# Insert sample data with imbalanced classessamples = [{'text': 'Great product!', 'label': 'positive', 'score': 0.9},{'text': 'Love it', 'label': 'positive', 'score': 0.85},{'text': 'Amazing quality', 'label': 'positive', 'score': 0.95},{'text': 'Best purchase ever', 'label': 'positive', 'score': 0.88},{'text': 'Highly recommend', 'label': 'positive', 'score': 0.92},{'text': 'Fantastic!', 'label': 'positive', 'score': 0.91},{'text': 'Terrible', 'label': 'negative', 'score': 0.1},{'text': 'Waste of money', 'label': 'negative', 'score': 0.15},{'text': 'It is okay', 'label': 'neutral', 'score': 0.5},{'text': 'Average product', 'label': 'neutral', 'score': 0.55},]data.insert(samples)
One cell of the notebook, copied as it is. Open it in Colab for the rest.
Load data from CSV and Excel files into Pixeltable tables for processing and analysis.
Load structured data from JSON files into Pixeltable tables for processing and analysis.
Load columnar data from Parquet files into Pixeltable tables for processing and analysis.
Load data from Excel spreadsheets (.xlsx) into Pixeltable tables.