Commit
·
b010c7c
1
Parent(s):
3d84e4a
yolo
Browse files- output_dataset.parquet +2 -2
- par.py → process.py +14 -9
- viz.py +7 -2
output_dataset.parquet
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:822e90e030672c607877152140280388b8a0d803489c396e06fc5b9e57fb0724
|
3 |
+
size 22498566
|
par.py → process.py
RENAMED
@@ -28,18 +28,23 @@ def collect_data(directory):
|
|
28 |
image_files = {re.search(r'(\d+)', filename).group(1): filename
|
29 |
for filename in os.listdir(directory) if filename.endswith('.jpg')}
|
30 |
|
31 |
-
#
|
32 |
-
for
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
if problem_id not in data:
|
38 |
data[problem_id] = {'Problem ID': problem_id, 'Images': [], 'in': None, 'out': None, 'cpp': None, 'md': None, 'sol.md': None}
|
39 |
|
40 |
-
|
41 |
-
|
42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
data[problem_id][file_type] = content
|
44 |
if file_type in ['md', 'sol.md']:
|
45 |
image_ids = extract_images(content)
|
|
|
28 |
image_files = {re.search(r'(\d+)', filename).group(1): filename
|
29 |
for filename in os.listdir(directory) if filename.endswith('.jpg')}
|
30 |
|
31 |
+
# Identify Markdown and solution Markdown files and establish correct problem IDs
|
32 |
+
markdown_files = [f for f in os.listdir(directory) if f.endswith('.md') or f.endswith('.sol.md')]
|
33 |
+
for mfile in markdown_files:
|
34 |
+
# Adjust the pattern if problem IDs include characters before "sol"
|
35 |
+
problem_id = re.sub(r'sol$', '', mfile.split('.')[0]) # Strip "sol" from end
|
|
|
36 |
if problem_id not in data:
|
37 |
data[problem_id] = {'Problem ID': problem_id, 'Images': [], 'in': None, 'out': None, 'cpp': None, 'md': None, 'sol.md': None}
|
38 |
|
39 |
+
# Now associate other files with these problem IDs
|
40 |
+
for filename in os.listdir(directory):
|
41 |
+
problem_id = re.sub(r'sol$', '', filename.split('.')[0]) # Strip "sol" from end if present
|
42 |
+
if problem_id in data: # Only process if the problem_id is recognized
|
43 |
+
file_type = filename.split('.')[-1]
|
44 |
+
file_path = os.path.join(directory, filename)
|
45 |
+
content = encode_file(file_path) if not filename.endswith('.jpg') else None
|
46 |
+
|
47 |
+
if file_type in ['in', 'out', 'cpp', 'md', 'sol.md']:
|
48 |
data[problem_id][file_type] = content
|
49 |
if file_type in ['md', 'sol.md']:
|
50 |
image_ids = extract_images(content)
|
viz.py
CHANGED
@@ -1,10 +1,15 @@
|
|
1 |
import pandas as pd
|
|
|
|
|
2 |
|
3 |
# Load the Parquet file
|
4 |
df = pd.read_parquet('output_dataset.parquet')
|
5 |
|
|
|
|
|
6 |
# Display the first few rows of the dataframe
|
7 |
-
print(df
|
8 |
|
9 |
# Basic statistics for numerical columns
|
10 |
-
print(df.describe())
|
|
|
|
1 |
import pandas as pd
|
2 |
+
# pd.set_option('display.max_columns', None) # None means no limit
|
3 |
+
# pd.set_option('display.width', None) # None means use the current terminal width
|
4 |
|
5 |
# Load the Parquet file
|
6 |
df = pd.read_parquet('output_dataset.parquet')
|
7 |
|
8 |
+
print(df.columns)
|
9 |
+
|
10 |
# Display the first few rows of the dataframe
|
11 |
+
print(df)
|
12 |
|
13 |
# Basic statistics for numerical columns
|
14 |
+
# print(df.describe())
|
15 |
+
#
|