Skip to content

Commit

Permalink
now working in py3
Browse files Browse the repository at this point in the history
  • Loading branch information
elliewix committed Oct 29, 2018
1 parent 2a84b39 commit 7ccd029
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Binary file modified .DS_Store
Binary file not shown.
12 changes: 5 additions & 7 deletions data_profilepy3.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,12 @@ def review_csv(file, mode='rt', headers=True, index_row=True, missing=''):
ids = "None declared"

num_rows = len(data)
data = map(list, zip(*data))
data = list(map(list, zip(*data)))

num_columns = len(col_names)
col_info = {'csv_basic': {'num_rows': num_rows, 'num_columns': num_columns, 'missing': missing}, 'cols': {}}
for i, col in enumerate(col_names):

info = {}
num_uniques = len(set(data[i]))
info['unique_values'] = str(num_uniques) + " (this includes missing values)"
Expand Down Expand Up @@ -99,10 +100,7 @@ def review_csv(file, mode='rt', headers=True, index_row=True, missing=''):

def make_md(file_name, file_data, headers, target):
dt = '{:%Y-%b-%d %H:%M:%S}'.format(datetime.datetime.now())
# print file_data
# print file_data
# for x, f_data in file_data.iteritems():
# print f_data

md = ""
md += "Data Profile for " + file_name + "\n\n"
md += "Generated on: " + dt + "\n"
Expand All @@ -117,7 +115,7 @@ def make_md(file_name, file_data, headers, target):
md += "* Using missing value of: " + missing_print + "\n"
md += "\n"
info = [file_data['columns'] for f in file_data.keys()][0]
for key in headers: # key, data in info.iteritems():
for key in headers:
data = info[key]
md += "**" + key + "**" + "\n"
md += "-" * (len(key) + 2) + "\n"
Expand All @@ -126,7 +124,7 @@ def make_md(file_name, file_data, headers, target):
md += "* Description of data values and units: \n"
md += "* Reason for missing values: \n"
md += "\n"
for column, val in data.iteritems(): # go through all the data info
for column, val in data.items(): # go through all the data info
md += "* " + column + ": " + str(val) + "\n"
md += "\n"
# print file_name
Expand Down

0 comments on commit 7ccd029

Please sign in to comment.