20 lines
523 B
Python
20 lines
523 B
Python
import pandas as pd
|
|
|
|
#variables
|
|
file_path = 'ps (30).xlsx'
|
|
sheet_name = 'ps (30)'
|
|
column_name = 'Student-ID'
|
|
|
|
df = pd.read_excel(file_path, sheet_name=sheet_name)
|
|
|
|
duplicate_ids= df[df.duplicated(subset=[column_name], keep=False)][column_name]
|
|
|
|
unique_duplicate_ids = duplicate_ids.drop_duplicates()
|
|
|
|
num_duplicates = len(unique_duplicate_ids)
|
|
|
|
if not unique_duplicate_ids.empty:
|
|
print(f"Duplicated Student-ID values (count: {num_duplicates}) :")
|
|
print(unique_duplicate_ids)
|
|
else:
|
|
print("No duplicates found.") |