Delete edit_parquest.py
Browse files- edit_parquest.py +0 -21
edit_parquest.py
DELETED
|
@@ -1,21 +0,0 @@
|
|
| 1 |
-
import pandas as pd
|
| 2 |
-
from pathlib import Path
|
| 3 |
-
|
| 4 |
-
# Specify the folder path containing parquet files
|
| 5 |
-
folder_path = "/Users/fredericlegrand/Documents/Code/Python tests/temp/data/chunk-000"
|
| 6 |
-
|
| 7 |
-
# Iterate through all parquet files in the folder
|
| 8 |
-
for file in Path(folder_path).glob("*.parquet"):
|
| 9 |
-
# Read parquet file
|
| 10 |
-
df = pd.read_parquet(file)
|
| 11 |
-
|
| 12 |
-
# Slice the first 6 items from the arrays in "action" and "observation.state"
|
| 13 |
-
df["action"] = df["action"].apply(lambda x: x[:6])
|
| 14 |
-
df["observation.state"] = df["observation.state"].apply(lambda x: x[:6])
|
| 15 |
-
|
| 16 |
-
# Overwrite the original file with the modified data
|
| 17 |
-
df.to_parquet(file)
|
| 18 |
-
|
| 19 |
-
print(f"Processed {file.name}")
|
| 20 |
-
|
| 21 |
-
print("All files processed.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|