Skip to content

Commit 6bcb9b7

Browse files
author
mole
committed
automatic set file timestamp format
1 parent 83d5946 commit 6bcb9b7

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

loadDataFilesUI.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from PyQt5 import QtCore, QtWidgets, uic
2-
2+
import pandas as pd
33
import os
44

55
class LoadDataFilesUI(QtWidgets.QWidget):
@@ -55,6 +55,22 @@ def openFile(self):
5555
print(datafile[-4:])
5656
if datafile[-4:]=='.csv':
5757
self.commaRB.setChecked(True)
58+
df = pd.read_csv(self.dataFileName, nrows=1)
59+
60+
# print(df)
61+
timestring = df.iloc[0,0]
62+
ncolon = timestring.count(':')
63+
if ncolon==2:
64+
self.datetimeFormatLE.setCurrentIndex(0)
65+
elif ncolon==1:
66+
self.datetimeFormatLE.setCurrentIndex(1)
67+
else:
68+
nspace = timestring.count(' ')
69+
if nspace==1:
70+
self.datetimeFormatLE.setCurrentIndex(2)
71+
else:
72+
self.datetimeFormatLE.setCurrentIndex(3)
73+
5874
pass
5975

6076
def loadFile(self):

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy