danielrosehill commited on
Commit
66adb25
·
1 Parent(s): dc3820c
data/csv/by-methodology/manifest.py DELETED
@@ -1,56 +0,0 @@
1
- import pandas as pd
2
- import os
3
-
4
- def generate_markdown_manifest_for_all_csvs():
5
- # Get the current working directory
6
- current_dir = os.getcwd()
7
-
8
- # Create a folder called 'params' within the current directory to store the markdown manifests
9
- output_folder = os.path.join(current_dir, 'params')
10
- if not os.path.exists(output_folder):
11
- os.makedirs(output_folder)
12
-
13
- # Get a list of all CSV files in the current directory
14
- csv_files = [f for f in os.listdir(current_dir) if f.endswith('.csv')]
15
-
16
- if not csv_files:
17
- print("No CSV files found in the current directory.")
18
- return
19
-
20
- # Loop through each CSV file and generate a manifest in markdown format
21
- for csv_file in csv_files:
22
- try:
23
- # Load CSV file into a pandas DataFrame
24
- csv_path = os.path.join(current_dir, csv_file)
25
- df = pd.read_csv(csv_path)
26
-
27
- # Prepare the manifest content
28
- markdown_content = f"# Manifest for {csv_file}\n\n"
29
- markdown_content += f"## Column Overview\n\n"
30
-
31
- for col in df.columns:
32
- # Skip the "Value" column
33
- if col == "Value":
34
- continue
35
-
36
- unique_values = df[col].dropna().unique()
37
- markdown_content += f"### {col}\n\n"
38
- markdown_content += "Parameters:\n\n"
39
- for val in unique_values:
40
- markdown_content += f"- {val}\n"
41
- markdown_content += "\n"
42
-
43
- # Generate the output filename for the markdown manifest
44
- output_file = os.path.join(output_folder, f"{os.path.splitext(csv_file)[0]}_manifest.md")
45
-
46
- # Write the markdown content to the file
47
- with open(output_file, 'w') as f:
48
- f.write(markdown_content)
49
-
50
- print(f"Manifest for {csv_file} saved to {output_file}")
51
-
52
- except Exception as e:
53
- print(f"Error processing {csv_file}: {e}")
54
-
55
- # Run the function
56
- generate_markdown_manifest_for_all_csvs()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
data/csv/narrower-list/airpollution.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e39dd7548419144482c3f8a27e4b67d6232f0887e3575ba6a7690db4f9790e31
3
+ size 785573
data/csv/narrower-list/land-conversion.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f66ca101cdfd67c3b6f84f94e86bb9cad77fd4300e2d16d22e92f0e59dd4dbab
3
+ size 673308
data/csv/narrower-list/land-use.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:94756565f4ff2c5171cf03b950b24e6824b3b403cc82e721e91a082e2d156ecd
3
+ size 637151
data/csv/narrower-list/waste.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:757c8a709e1b306d72e9412dc4720feb7a4eccae7b306fa18a9dc7f20475b149
3
+ size 533099
data/csv/narrower-list/water-consumption.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f03d23e93ef2179a7405d9061cfc194ab13fc56ad9bad0bb16675cc59e793850
3
+ size 99329
data/csv/narrower-list/water-pollution.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fd28f3379f02b9e40b143254168c1b881972c7c1469b91c74d6cd42843b99b3a
3
+ size 8238494