Insert Data


After creating a Pinecone index, you can start inserting data (vector embeddings) into the index.


import pinecone


pinecone.create_index("pinecone-index", metric="euclidean")

Data Preparation

When you insert data to a Pinecone index, you upload (id, vector) pairs, just as you would with a key-value store.

You can also structure your data as a pandas DataFrame.

import pandas as pd
import numpy as np

df = pd.DataFrame(data={
    "id": ["A", "B", "C", "D", "E"],
    "vector": [ii + np.ones(2) for ii in range(5)]

Insert Vectors

First connect to the index.

index = pinecone.Index("pinecone-index")

Then insert the data as a list of (id, vector) tuples. That’s it! You can see the upload in progress. UpsertResult(id='A') is an acknowledgement that the vector with id="A" has been inserted successfully.

Tip: Uploading data to Pinecone should be very fast (10K+ items per second). If you are experiencing slow uploads, read about Performance Tuning to improve your upload speeds.

acks = index.upsert(items=zip(, df.vector))

# [UpsertResult(id='A'), UpsertResult(id='B')]

Insert One Vector at a Time

You can insert one vector at a time. This is helpful if you have multiple clients updating the same index infrequently.

index.unary_upsert(item=("F", 5 + np.ones(2)))

Delete the Index

Free up computing resources and delete all of the data.