Я получаю ошибку, что контент не является в моем диске, но я уже загрузил и установил свой Google Drive [закрыто]Python

Программы на Python
Ответить Пред. темаСлед. тема
Anonymous
 Я получаю ошибку, что контент не является в моем диске, но я уже загрузил и установил свой Google Drive [закрыто]

Сообщение Anonymous »

import pandas as pd
import zipfile

# Open the zip file
with zipfile.ZipFile("/content/drive/MyDrive/g collab dataset folder/odir dataset.zip", 'r') as zip_ref:
# Get a list of all files in the archive
file_list = zip_ref.namelist()
# Print the list to inspect the file names and paths within the archive
print(file_list)

# Assuming the CSV file is named 'data.csv' and is located in the 'ODIR-5K' folder
# Update csv_path with the actual name and path if it's different
csv_path = '/content/odir dataset/ODIR-5K/ODIR-5K/data.xlsx'

# Check if the file exists in the archive
if csv_path in file_list:
with zip_ref.open(csv_path) as csv_file:
# Read the CSV file
df = pd.read_csv(csv_file)
else:
print(f"Error: {csv_path} not found in the zip archive.")


Подробнее здесь: https://stackoverflow.com/questions/796 ... d-mount-my
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

Вернуться в «Python»