0

I have a DataFrame with one column containing .txt files.

How can I access the text files?

e

When I try:

f = open(df.embedding_file.iloc[0], "r")

I get the following error :

FileNotFoundError: [Errno 2] No such file or directory: 'doc_embeddings_1.txt'
Sigmund
  • 69
  • 1
  • 9
  • 2
    The error's pretty clear. It says the file is not found. Is the file present at the same location from where you are running this script? – Mayank Porwal May 23 '22 at 17:48
  • 1
    You may be missing fullpath – Pavan Chandaka May 23 '22 at 17:48
  • @Mayank Porwal I assumed the files are stored in the dataframe row? Are you saying it is more likely the df only contains names of files stored somewhere else? – Sigmund May 23 '22 at 17:50
  • 4
    @Sigmund Yes, that's exactly what it is. DF just has the names to the files, not the actual files. – Mayank Porwal May 23 '22 at 17:51
  • I closed the question as a duplicate, but now that I'm reading the comments, apparently the problem was more fundamental. It seems like you just had a brain fart, in which case there's no real point reopening the question, but just in case you're genuinely still confused, you could [edit] to clarify, like "I don't understand why I'm getting this error because [x]". If you want more tips, check out [ask]. – wjandrea May 23 '22 at 20:25

0 Answers0