How to: Upload CSV files to Labelbox

Hello Labelbox Community :wave: ,

Ever wondered how to get your CSV files up and running on Labelbox? Let’s dive into it together! :rocket:

This guide provides a simple way to upload local CSV files directly onto Labelbox’s platform. We’ll be using the open-source Labelbox <> Pandas Python integration to make this process a breeze.

How to Upload CSV Files to Labelbox

  1. Prepare Your Data: Make sure your CSV is neat and tidy. Each row should represent a data point, and each column should represent a feature or attribute of that data point.

  2. Use LabelPandas: Labelbox has a cool library called LabelPandas that lets you work with CSV and tabular data seamlessly via a Pandas data frame.

  3. Install Labelbox Python SDK and LabelPandas:

pip3 install labelbox
pip3 install labelpandas --upgrade -q
  1. Import necessary files:
import labelpandas as lp
import pandas as pd
  1. Set up your Labelbox client:
# Replace with your Labelbox API key
api_key = "API_KEY"
client = lp.Client(api_key)
  1. Load your CSV file: This code snippet reads your CSV file into a Pandas DataFrame, allowing you to manipulate and view your data before uploading it to Labelbox. It’s a good practice to preview your data to ensure it’s correctly formatted and ready for labeling
# Path to your CSV file
csv_path = 
df = pd.read_csv(csv_path)
  1. Create a dataset in Labelbox:
dataset_id = client.lb_client.create_dataset(name="CSV Upload Test").uid
  1. Upload your CSV data to Labelbox:
results = client.create_data_rows_from_table(
    table = df,
    dataset_id = dataset_id,
    skip_duplicates = False, # If True, will skip data rows where a global key is already in use,
    verbose = True, # If True, prints information about code execution

That’s it! You’ve just uploaded your CSV files to Labelbox. :tada: You can also reference our docs on working with tabular data.

Feel free to share your experiences, ask questions, or share tips in the comments below. Let’s make the most of our data labeling journey together!

Additional Resources:
Example Notebooks
LabelPandas library


Thanks @janny this is a great how-to guide.

1 Like