Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 34 additions & 7 deletions pinecone/db_data/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,38 @@ def upsert_from_dataframe(
):
"""Upserts a dataframe into the index.

Args:
df: A pandas dataframe with the following columns: id, values, sparse_values, and metadata.
namespace: The namespace to upsert into.
batch_size: The number of rows to upsert in a single batch.
show_progress: Whether to show a progress bar.
:param df: A pandas dataframe with the following columns: id, values, sparse_values, and metadata.
:type df: pandas.DataFrame
:param namespace: The namespace to upsert into.
:type namespace: str, optional
:param batch_size: The number of rows to upsert in a single batch.
:type batch_size: int, optional
:param show_progress: Whether to show a progress bar.
:type show_progress: bool, optional

.. code-block:: python

import pandas as pd
from pinecone import Pinecone

pc = Pinecone()
idx = pc.Index(host="your-index-host")

# Create a dataframe with vector data
df = pd.DataFrame({
'id': ['id1', 'id2', 'id3'],
'values': [[0.1, 0.2, 0.3], [0.4, 0.5, 0.6], [0.7, 0.8, 0.9]],
'metadata': [{'key': 'value1'}, {'key': 'value2'}, {'key': 'value3'}]
})

# Upsert the dataframe
idx.upsert_from_dataframe(
df=df,
namespace="my-namespace",
batch_size=100,
show_progress=True
)

"""
pass

Expand Down Expand Up @@ -276,7 +303,7 @@ def upsert_records(self, namespace: str, records: list[dict]) -> UpsertResponse:
Pinecone,
CloudProvider,
AwsRegion,
EmbedModel
EmbedModel,
IndexEmbed
)

Expand Down Expand Up @@ -382,7 +409,7 @@ def search(
Pinecone,
CloudProvider,
AwsRegion,
EmbedModel
EmbedModel,
IndexEmbed
)

Expand Down
Loading