In [32]:
import pandas as pd
# An object is created that reads the file that is enter by the user.
file = input("Enter File Name: ")
df = pd.read_csv(file)
#Below are the (3) tables that are used by our client and is completed via their protocol.
# alt1
alt1 = pd.DataFrame([[1, 2, 3, 4, 5, 6, 7] , [1, 2, 3, 4, 5, 6, 7], [1, 2, 3, 4, 5, 6, 7]],
columns= ['One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven'])
# alt2
alt2 = pd.DataFrame([[1, 3], [1, 3], [2, 4], [2, 4], [2, 4], [3, 6], [3, 6], [3, 6], [1, 3]],
columns = ['One', 'Two'])
# alt3
alt3 = pd.DataFrame([["a", "b", "c", "d"], ["a", "b", "c", "d"], ["a", "b", "c", "d"],
["a", "b", "c", "d"], ["a", "b", "c", "d"], ["a", "b", "c", "d"], ["a", "b", "c", "d"]],
columns = ['One', 'Two', 'Three', 'Four'])
# (3) 'if' Boolean tests are ran to detect the Primary Keys in the user's data table.*
# Once the Primary Key is detected, the matching and completed data table is retrieved, converted to a tsv file, renamed and...
# saved back into working folder.
if len(df.columns) == 7:
df = alt1
df.to_csv('DEST_BH_atl1.tsv', index = False, sep = '\t')
print(df)
if len(df.columns) == 1:
df = alt2
df.to_csv('DEST_BH_atl2.tsv', index = False, sep = '\t')
print(df)
if len(df.columns) == 4:
df = alt3
df.to_csv('DEST_BH_atl3.tsv', index = False, sep = '\t')
print(df)
# *Refer to the README.md file for the Primary Key specifications.