Python Forum
Errors if an xlsx file has blank rows in the beginning….
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Errors if an xlsx file has blank rows in the beginning….
#1
Greetings!
This is my first try using Pandas.
The sniped below works file if the files(.XLSX) do not have blank lines in the beginning.
I thought by using 'dropna' I'll fix the problem but it does not:
exlf = exlf.dropna(axis = 0, how = 'all')
Snipped:
import pandas as pd

exlf = pd.read_excel('C:/01/XLS_Files/SHORT_2.xlsx')
exlf = exlf.dropna(axis = 0, how = 'all')
#print(f" Blank Row Removed.. {exlf}")
four_col = exlf.iloc[: , [0,4,9,17]].copy()    # <--- Filtering 4 Columns
#print('\n. Only 4(Four) Columns \n :',four_col) 

filtered_l = four_col[(four_col['VR Site'] =='ORVCC') & (four_col['VR Duration(Days)'] >=449)]
print(filtered_l)
Any help is appreciated.
Reply


Messages In This Thread
Errors if an xlsx file has blank rows in the beginning…. - by tester_V - Aug-25-2023, 03:42 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Export dataframe to xlsx - Error "zipfile.BadZipFile: File is not a zip file" Baggio 10 62,725 Mar-12-2021, 01:02 PM
Last Post: buran
  Python - Pandas writing blank files to file tdunphy 0 2,026 Jan-14-2021, 12:11 AM
Last Post: tdunphy
  XLSX file with multiple sheets to josn file ovidius 2 2,275 Apr-05-2020, 09:22 AM
Last Post: ovidius
  How to copy a .csv worksheet into a .xlsx file without the number values turning into YoshikageKira 7 3,637 Mar-28-2020, 10:38 AM
Last Post: buran
  Write specific rows from pandas dataframe to csv file pradeepkumarbe 3 5,577 Oct-18-2018, 09:33 PM
Last Post: volcano63
  How to filter specific rows from large data file Ariane 7 8,298 Jun-29-2018, 02:43 PM
Last Post: gontajones
  Write data into existing Excel (xlsx) file with multiple sheets BNB 1 15,397 Jun-01-2017, 04:22 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020