gpt-3.5-turbo-0613· OpenAI
WildChat-4.8M (AI2)
Write me a python without explanation: I have an excel The path of excel is…
- User
Write me a python without explanation: I have an excel The path of excel is C:\Users\gnulch2\Desktop\NUR Procedural 01052023 to 310523.xlsx Analysis the data such to find unique 'Case No', print the count. Analysis column
- Assistant
from openpyxl import load_workbook
Load the excel file
filename = "C:\Users\gnulch2\Desktop\NUR Procedural 01052023 to 310523.xlsx" workbook = load_workbook(filename)
Select the active sheet
sheet = workbook.active
Create an empty set to store unique case numbers
unique_cases = set()
Iterate through each row in the 'Analysis' column
for row in sheet.iter_rows(min_row=2, max_row=sheet.max_row, min_col=5, max_col=5): case_no = row[0].value unique_cases.add(case_no)
Print the count of unique case numbers
print("Count of unique case numbers: ", len(unique_cases))