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
Я получаю ошибку, что контент не является в моем диске, но я уже загрузил и установил свой Google Drive [закрыто] ⇐ Python
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Google Drive API: обновление папки с звездой не отражается в Google Drive
Anonymous » » в форуме Python - 0 Ответы
- 62 Просмотры
-
Последнее сообщение Anonymous
-