Commit 1fc005a2 authored by Marie FU's avatar Marie FU

update Element to tsv and correct clean csv

parent 093cc8b3
......@@ -176,8 +176,7 @@ if STATE.file is not None:
toStartOfFile(STATE.file)
STATE.fileData = ""
addColumnsNamestoTSV(STATE.file, STATE.encoding, STATE.separator,STATE.columnMap)
STATE.fileData = addColumnsNamestoTSV(STATE.file, STATE.encoding, STATE.separator,STATE.columnMap)
toStartOfFile(STATE.file)
......@@ -236,8 +235,7 @@ if STATE.file is not None:
errors += file + ": " + STATE.general_text_dict['err_columns'] + "\n"
else:
STATE.fileData = ""
addColumnsNamestoTSV(STATE.currentFile, STATE.encoding, STATE.separator,STATE.columnMap)
STATE.fileData = addColumnsNamestoTSV(STATE.currentFile, STATE.encoding, STATE.separator,STATE.columnMap)
# set a variable to check if there are any detected errors
# and construction of correct file content while checking
......@@ -250,7 +248,7 @@ if STATE.file is not None:
else:
with open(STATE.zipDir.name+"/CleanCSV/"+file[:-4]+".tsv","w") as file:
file.write(STATE.fileData.replace("\"","”"))
if STATE.allFileData != "":
if STATE.allFileData == "":
STATE.allFileData = STATE.fileData
else:
STATE.allFileData += STATE.fileData[81:]
......
This diff is collapsed.
......@@ -7,8 +7,6 @@ Authors:
from io import StringIO
import typing
from anyio import open_file
from numpy import isin
from streamlit.runtime.uploaded_file_manager import UploadedFile
import streamlit as st
from src.gerneralFileOP import *
......@@ -237,7 +235,7 @@ def addColumnsNamestoTSV(file : UploadedFile|str, encoding : str, separator : st
filecontent = StringIO(file.getvalue().decode(encoding)).read().split("\n")[0].split(separator)
elif isinstance(file, str):
with open(file, "r", encoding=encoding) as f:
filecontent = f.read()
filecontent = f.read().split(separator)
for name in filecontent :
if name in columnMap.keys():
if fileData != "":
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment