Skip to content

Commit 6e7008f

Browse files
authored
Update rjj.py
1 parent 3def88b commit 6e7008f

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

rjj.py

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# !/usr/bin/env python3
22

3-
__version__="0.9.1"
3+
__version__="0.9.2"
44

55
import argparse, io, os, json, csv, glob, hashlib, warnings, base64, random, math
66
from sklearn.base import BaseEstimator, TransformerMixin
@@ -117,6 +117,32 @@ def split_timestamp(timestamp):
117117
except Exception as e:
118118
print(f"Error reading the file: {e}")
119119

120+
def timestamp_glue():
121+
csv_files = list_csv_files()
122+
if not csv_files:
123+
print("No CSV files found in the current directory.")
124+
return
125+
print("Available CSV files:")
126+
for i, file in enumerate(csv_files, 1):
127+
print(f"{i}. {file}")
128+
try:
129+
choice = int(input("Select the CSV file by entering the corresponding number: "))
130+
csv_file = csv_files[choice - 1]
131+
except (ValueError, IndexError):
132+
print("Invalid selection.")
133+
return
134+
try:
135+
df = pd.read_csv(csv_file)
136+
df['timestamp'] = pd.to_datetime(df['Year'].astype(str) + '/' +
137+
df['Month'].astype(str) + '/' +
138+
df['Day'].astype(str) + ' ' +
139+
df['Time'])
140+
output = "output.csv"
141+
df.to_csv(output, index=False)
142+
print(f"Results saved to {output}")
143+
except Exception as e:
144+
print(f"Error reading the file: {e}")
145+
120146
def compute_point():
121147
csv_files = list_csv_files()
122148
if not csv_files:
@@ -3480,6 +3506,7 @@ def __init__():
34803506
subparsers.add_parser('mj', help='minify json')
34813507
subparsers.add_parser('mh', help='minify html')
34823508
subparsers.add_parser('cut', help='cut timestamp')
3509+
subparsers.add_parser('glue', help='glue timestamp')
34833510
subparsers.add_parser('code', help='encode or decode')
34843511
subparsers.add_parser('json', help='join all json up')
34853512
subparsers.add_parser('join', help='join it up')
@@ -3529,6 +3556,8 @@ def __init__():
35293556
json_merger()
35303557
elif args.subcommand == 'cut':
35313558
timestamp_cutter()
3559+
elif args.subcommand == 'glue':
3560+
timestamp_glue()
35323561
elif args.subcommand == 'mh':
35333562
html_minifier()
35343563
elif args.subcommand == 'mj':

0 commit comments

Comments
 (0)