Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- import pandas as pd
- from pandas import ExcelWriter
- from pandas import ExcelFile
- fileName= input("Enter file name here (Case Sensitve) > ")
- df = pd.read_excel(fileName +'.xlsx', sheetname=None, ignore_index=True)
- xl = pd.ExcelFile(fileName +'.xlsx')
- SystemCount= len(xl.sheet_names)
- df1 = pd.DataFrame([])
- for y in range(1, int(SystemCount)+ 1):
- df = pd.read_excel(xl,'System ' + str(y))
- df['System {0}'.format(y)] = "1"
- df1 = df1.append(df)
- df1 = df1.sort_values(['Email'])
- df = df1['Email'].value_counts()
- df1['Count'] = df1.groupby('Email')['Email'].transform('count')
- print(df1)
- Email System 1 System 2 System 3 System 4
- test_1_@test.com NaN 1 NaN NaN
- test_2_@test.com NaN NaN 1 NaN
- test_2_@test.com 1 NaN NaN NaN
- test_2_@test.com NaN NaN NaN 1
- test_3_@test.com NaN NaN NaN NaN
- test_4_@test.com NaN NaN 1 NaN
- test_5_@test.com 1 NaN NaN NaN
- test_5_@test.com NaN NaN 1 NaN
- test_5_@test.com NaN NaN NaN 1
Add Comment
Please, Sign In to add comment