Skip to content

Commit

Permalink
fussing over markdown rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
elliewix committed Oct 29, 2018
1 parent d613e58 commit 31c8462
Show file tree
Hide file tree
Showing 4 changed files with 342 additions and 381 deletions.
Binary file modified .DS_Store
Binary file not shown.
19 changes: 10 additions & 9 deletions data_profilepy3.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def review_csv(file, mode='rt', headers=True, index_row=True, missing=''):
else:
uval_print.append(x)
uval_print.sort() # sorting unique values for pretty printing
info['unique_value_content'] = "The values are:\n\t* " + "\n\t* ".join(uval_print) + "\n"
info['unique_value_content'] = "The values are:\n\t* " + "\n\t* ".join(uval_print)
else:
info['unique_value_content'] = "Not reported (More than 10 unique values)"
info['missing'] = data[i].count(missing)
Expand All @@ -76,13 +76,14 @@ def review_csv(file, mode='rt', headers=True, index_row=True, missing=''):
for d in data[i]:
try:
d = float(d)
print(d, "this is a float")
# dcount += 1
passed_digits.append(float(d))
except:
# this is fine becasue this is simply testing
# if it can be done at all
# stop fretting, elizabeth.
pass # passed_digits.append('failed to convert to float')
digits = len(passed_digits)
print(digits)
totalvalues = len([d for d in data[i] if len(d) > 0])

if totalvalues == 0:
Expand Down Expand Up @@ -125,13 +126,13 @@ def make_md(file_name, file_data, headers, target):
data = info[key]
md += "**" + key + "**" + "\n"
md += "-" * (len(key) + 2) + "\n"
md += "* Description of column: \n"
md += "* Collection methods: \n"
md += "* Description of data values and units: \n"
md += "* Reason for missing values: \n"
md += "\n"
md += "* Description of column: (you fill in)\n"
md += "* Collection methods: (you fill in)\n"
md += "* Description of data values and units: (you fill in)\n"
md += "* Reason for missing values: (you fill in)\n"
# md += "\n"
for column, val in data.items(): # go through all the data info
md += "* " + column.replace('_', ' ') + ": " + str(val) + "\n"
md += "* " + column.replace('_', ' ').capitalize() + ": " + str(val) + "\n"
md += "\n"
# print file_name
write_name = file_name.stem + '_DataProfile.md'
Expand Down
Loading

0 comments on commit 31c8462

Please sign in to comment.