Reputation: 85
I am trying to import an Excel (.xlsx
) file into the Spyder IDE. Everything works fine when I import small files, using openpyxl
, but for this particular file (around 30MB and 800k rows) my system crashes.
Following is the part of code that imports:
from openpyxl import load_workbook
wb = load_workbook(filename=path + 'cleaned_noTC_s_PERNO_Date.xlsx', data_only=True)
Can anyone please let me know what is wrong with this method and what else can I use to import the stated file?
Upvotes: 0
Views: 1235
Reputation: 21961
Try using the excellent pandas library, it has very robust excel reading functionality and is pretty good with memory in my experience:
See here:
import pandas as pd
xl = pd.read_excel("file.xlsx")
Upvotes: 1
Reputation: 19497
It sounds like you're running out of memory. If you don't need to edit the file then you can use read_only
mode, otherwise you'll need more memory.
Upvotes: 0