Skip to content

Commit

Permalink
ignore bad lines on load
Browse files Browse the repository at this point in the history
  • Loading branch information
callumrollo committed May 10, 2024
1 parent 4f7c6e2 commit 0cffb64
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions cmd_data_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@
import math
import logging
from pathlib import Path
import datetime

_log = logging.getLogger(__name__)


def load_all_cmd(path):
df = pd.read_csv(path, sep=";", usecols=range(0, 6), header=0)
df = pd.read_csv(path, sep=";", usecols=range(0, 6), header=0, encoding_errors='ignore')
if("Message" in df.columns):
new_cmd = pd.DataFrame({"DATE_TIME": pd.to_datetime(df['Date'] + ' ' + df['Time'], dayfirst=True, yearfirst=False,),
"LOG_MSG": df.Message,
Expand All @@ -23,7 +22,6 @@ def load_all_cmd(path):
data['DATE_TIME'] = pd.to_datetime(data.DATE_TIME, dayfirst=True, yearfirst=False, )
data['Cycle'] = df.Cycle
else:
df = pd.read_csv(path, sep=";", usecols=range(0, 6), header=0)
new_cmd = pd.DataFrame({"DATE_TIME": pd.to_datetime(df.DATE_TIME, dayfirst=True, yearfirst=False, ),
"LOG_MSG": df.LOG_MSG})
a = new_cmd['LOG_MSG'].str.split(',', expand=True)
Expand Down

0 comments on commit 0cffb64

Please sign in to comment.