Skip to content

Commit

Permalink
allowing it to take file or folder source
Browse files Browse the repository at this point in the history
  • Loading branch information
elliewix committed Aug 12, 2016
1 parent 21cfa20 commit 8f5d00c
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
1 change: 1 addition & 0 deletions MiddlesexVagrants1777-1786v1.1.csv

Large diffs are not rendered by default.

10 changes: 7 additions & 3 deletions data_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,13 @@ def get_headers(file):
def main(source, target, kind, missingcode):

#files = [source + f for f in getFiles(source)]
files = glob.glob(source + "*")
num_files = len(files)
if num_files < 10:
if os.path.isdir(source):
files = glob.glob(source + "*")
num_files = len(files)
elif os.path.isfile(source):
files = [source] # forcing this into a list of 1 so for loop works
num_files = 1
if num_files < 10: # change this number if you care
print "Generating profile for: " + ", ".join(files)
else:
print "Generating profiles for " + str(num_files) + " files"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p>Data Profile for vagrants/MiddlesexVagrants1777-1786v1.1.csv</p>
<p>Generated on: 2016-Aug-11 19:40:27</p>
<p>Data Profile for MiddlesexVagrants1777-1786v1.1.csv</p>
<p>Generated on: 2016-Aug-11 19:47:01</p>
<p>Number of columns: 29
Number of rows: 14789</p>
<h2><strong>Vagrant ID Number</strong></h2>
Expand Down
4 changes: 2 additions & 2 deletions vagrant-profiles/MiddlesexVagrants1777-1786v1_DataProfile.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Data Profile for vagrants/MiddlesexVagrants1777-1786v1.1.csv
Data Profile for MiddlesexVagrants1777-1786v1.1.csv

Generated on: 2016-Aug-11 19:40:27
Generated on: 2016-Aug-11 19:47:01


Number of columns: 29
Expand Down
6 changes: 3 additions & 3 deletions vagrant-profiles/vagrant-profiles_DataProfiles.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"vagrants/MiddlesexVagrants1777-1786v1.1.csv": {
"MiddlesexVagrants1777-1786v1.1.csv": {
"columns": {
"Session End Month": {
"percent_digit": "100%",
Expand Down Expand Up @@ -268,10 +268,10 @@
"num_columns": 29
},
"file_metadata": {
"last_access": "2016-08-11 16:45:28",
"last_access": "2016-08-11 19:46:38",
"size": 4641076,
"last_modified": "2016-04-24 17:31:01",
"filename": "vagrants/MiddlesexVagrants1777-1786v1.1.csv"
"filename": "MiddlesexVagrants1777-1786v1.1.csv"
}
}
}

0 comments on commit 8f5d00c

Please sign in to comment.