xlrd

parse xlsx file having merged cells using python or pyspark

parse xlsx file having merged cells using python or pyspark Question: I want to parse an xlsx file. Some of the cells in the file are merged and working as a header for the underneath values. But do not know what approach I should select to parse the file. Shall I parse the file from …

Total answers: 1

Python Pandas can't read .xls file though engine is xlrd

Python Pandas can't read .xls file though engine is xlrd Question: have a 1 GB excel sheet with xls format (old excel), and I can’t read it with pandas df = pd.read_excel("filelocation/filename.xls",engine = "xlrd") XLRDError: Unsupported format, or corrupt file: Expected BOF record; found b'<html>rn’ and if removed the engine it sends this error ValueError: …

Total answers: 2

how to convert the int Date to datetime

how to convert the int Date to datetime Question: i’ve combined many dateframes but the date is not match as it’s look like (datetime & int) as below , it’s contains float number and datetime date. Date 2022-05-31 00:00:00 2022-05-31 00:00:00 2022-05-31 00:00:00 2022-05-31 00:00:00 44713.0 44713.0 44713.0 44713.0 44713.0 44713.0 44713.0 i’m tried to …

Total answers: 1

How do I delete/ignore some rows while parsing data from Excel using Python

How do I delete/ignore some rows while parsing data from Excel using Python Question: Recently I am trying to parse data from Excel sheet using Python and I successfully parsed it but I don’t need some rows from that Excel sheet. So how do I do it(may be using looping)? Here the code which I …

Total answers: 1

Compare 2 excel files using Python

Compare 2 excel files using Python Question: I have two xlsx files as follows: value1 value2 value3 0.456 3.456 0.4325436 6.24654 0.235435 6.376546 4.26545 4.264543 7.2564523 and value1 value2 value3 0.456 3.456 0.4325436 6.24654 0.23546 6.376546 4.26545 4.264543 7.2564523 I need to compare all cells, and if a cell from file1 != a cell from …

Total answers: 6

Reading Excel file is magnitudes slower using openpyxl compared to xlrd

Reading Excel file is magnitudes slower using openpyxl compared to xlrd Question: I have an Excel spreadsheet that I need to import into SQL Server on a daily basis. The spreadsheet will contain around 250,000 rows across around 50 columns. I have tested both using openpyxl and xlrd using nearly identical code. Here’s the code …

Total answers: 3

Python XLRD use Range

Python XLRD use Range Question: I want to assign an excel range to a variable: import xlrd file = r”C:UsersLisaDesktopFrankexport.XLSX” book = xlrd.open_workbook(file) sheet = book.sheet_by_index(0) data = [range(“A3:D7”)] , but I get an error: data = [range(“A3:D7”)] TypeError: ‘str’ object cannot be interpreted as an integer Any ideas? Asked By: Trenera || Source Answers: …

Total answers: 2

Convert date from excel in number format to date format python

Convert date from excel in number format to date format python Question: I am reading data from excel and manipulating the data using python. But dates are coming as integers. How can I convert the dates back to date format? 5/15/2015 is coming as 42139.00 Asked By: user2728024 || Source Answers: The module xlrd provides …

Total answers: 2

Read merged cells in Excel with Python

Read merged cells in Excel with Python Question: I am trying to read merged cells of Excel with Python using xlrd. My Excel: (note that the first column is merged across the three rows) A B C +—+—+—-+ 1 | 2 | 0 | 30 | + +—+—-+ 2 | | 1 | 20 | …

Total answers: 7

GroupBy results to dictionary of lists

GroupBy results to dictionary of lists Question: I have an excel sheet that looks like so: Column1 Column2 Column3 0 23 1 1 5 2 1 2 3 1 19 5 2 56 1 2 22 2 3 2 4 3 14 5 4 59 1 5 44 1 5 1 2 5 87 3 …

Total answers: 2