Чтение CSV-файла в Jupyter:
filename = "myfile.csv"
start_pd = time.time()
try:
with open (filename, 'rb') as file:
reader = pd.read_csv(filename, chunksize=10000, error_bad_lines=False, header=None)
df = pd.concat([x for x in reader], ignore_index=True)
df.columns = dfcolslist
file.close #also tried reader.close() and file.closed
print("{} read successfully in {:.2f} secs".format(filename, time.time() - start_pd))
except IOError:
print("could not read {}".format(filename))
cmd сообщение об ошибке:
> ren "myfile.csv" "date_myfile.csv"
The process cannot access the file because it is being used by another process.
Сообщение об ошибке GUI:
The action cannot be completed because the file is open in Python