Pandas version checks
-
[X] I have checked that this issue has not already been reported.
-
[X] I have confirmed this bug exists on the latest version of pandas.
-
[X] I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
def generate_embedding(prompt):
# Replace this with your actual embedding function
return openai.Embedding.create(
input=prompt,
model=model)['data'][0]['embedding']
# Iterate over the rows and generate embeddings
embeddings = []
embeddings_backup = []
for index, row in questions_3.iterrows():
prompt = row['column_one']
print(index)
time.sleep(0.5)
embedding = generate_embedding(prompt)
embeddings.append(embedding)
embeddings_backup.append([prompt, embedding])
# Add the embeddings to the dataframe
questions_3['embeddings'] = embeddings
questions_3.to_excel('question_embeddings.xlsx')
```
Issue Description
using openai ada model for generating embedding the embedding is 34k+ characters saving to excel succeeds, but excel has character limit
Expected Behavior
this save should not succeed, as it is like a suppressed error, that leads to data loss
Installed Versions
INSTALLED VERSIONS
------------------
commit : 2e218d10984e9919f0296931d92ea851c6a6faf5
python : 3.9.6.final.0
python-bits : 64
OS : Darwin
OS-release : 22.3.0
Version : Darwin Kernel Version 22.3.0: Mon Jan 30 20:39:35 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T8103
machine : arm64
processor : arm
byteorder : little
LC_ALL : None
LANG : None
LOCALE : None.UTF-8
pandas : 1.5.3
numpy : 1.24.2
pytz : 2022.7.1
dateutil : 2.8.2
setuptools : 60.2.0
pip : 21.3.1
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.1.2
IPython : None
pandas_datareader: None
bs4 : 4.12.0
bottleneck : None
brotli : None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : None
numba : None
numexpr : None
odfpy : None
openpyxl : 3.1.2
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : None
snappy : None
sqlalchemy : 1.4.47
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
zstandard : None
tzdata : None
Comment From: phofl
Hi, thanks for your report. This is most likely an upstream issue because we don't actually create the actual excel file. Could you report there?
Comment From: phofl
Closing