|
1 | 1 | # !/usr/bin/env python3
|
2 | 2 |
|
3 |
| -__version__="0.9.1" |
| 3 | +__version__="0.9.2" |
4 | 4 |
|
5 | 5 | import argparse, io, os, json, csv, glob, hashlib, warnings, base64, random, math
|
6 | 6 | from sklearn.base import BaseEstimator, TransformerMixin
|
@@ -117,6 +117,32 @@ def split_timestamp(timestamp):
|
117 | 117 | except Exception as e:
|
118 | 118 | print(f"Error reading the file: {e}")
|
119 | 119 |
|
| 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 | + |
120 | 146 | def compute_point():
|
121 | 147 | csv_files = list_csv_files()
|
122 | 148 | if not csv_files:
|
@@ -3480,6 +3506,7 @@ def __init__():
|
3480 | 3506 | subparsers.add_parser('mj', help='minify json')
|
3481 | 3507 | subparsers.add_parser('mh', help='minify html')
|
3482 | 3508 | subparsers.add_parser('cut', help='cut timestamp')
|
| 3509 | + subparsers.add_parser('glue', help='glue timestamp') |
3483 | 3510 | subparsers.add_parser('code', help='encode or decode')
|
3484 | 3511 | subparsers.add_parser('json', help='join all json up')
|
3485 | 3512 | subparsers.add_parser('join', help='join it up')
|
@@ -3529,6 +3556,8 @@ def __init__():
|
3529 | 3556 | json_merger()
|
3530 | 3557 | elif args.subcommand == 'cut':
|
3531 | 3558 | timestamp_cutter()
|
| 3559 | + elif args.subcommand == 'glue': |
| 3560 | + timestamp_glue() |
3532 | 3561 | elif args.subcommand == 'mh':
|
3533 | 3562 | html_minifier()
|
3534 | 3563 | elif args.subcommand == 'mj':
|
|
0 commit comments