Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,21 +1,22 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import pandas as pd
|
| 3 |
import csv
|
| 4 |
-
import
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
# Load the CSV data
|
| 7 |
@st.cache_data
|
| 8 |
def load_data(file_path):
|
| 9 |
def custom_csv_parser(file_path):
|
|
|
|
| 10 |
with open(file_path, 'r', newline='', encoding='utf-8') as csvfile:
|
| 11 |
-
reader = csv.reader(csvfile, delimiter=',', quotechar='"')
|
| 12 |
-
parsed_data = []
|
| 13 |
for row in reader:
|
| 14 |
parsed_row = []
|
| 15 |
for field in row:
|
| 16 |
-
if field.startswith('"') and field.endswith('"'):
|
| 17 |
-
parsed_row.append(field.strip('"'))
|
| 18 |
-
elif field.startswith('[') and field.endswith(']'):
|
| 19 |
parsed_row.append(field)
|
| 20 |
else:
|
| 21 |
parsed_row.append(field)
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import pandas as pd
|
| 3 |
import csv
|
| 4 |
+
import sys
|
| 5 |
+
|
| 6 |
+
# Increase the field size limit
|
| 7 |
+
csv.field_size_limit(sys.maxsize)
|
| 8 |
|
| 9 |
# Load the CSV data
|
| 10 |
@st.cache_data
|
| 11 |
def load_data(file_path):
|
| 12 |
def custom_csv_parser(file_path):
|
| 13 |
+
parsed_data = []
|
| 14 |
with open(file_path, 'r', newline='', encoding='utf-8') as csvfile:
|
| 15 |
+
reader = csv.reader(csvfile, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)
|
|
|
|
| 16 |
for row in reader:
|
| 17 |
parsed_row = []
|
| 18 |
for field in row:
|
| 19 |
+
if (field.startswith('"') and field.endswith('"')) or (field.startswith('[') and field.endswith(']')):
|
|
|
|
|
|
|
| 20 |
parsed_row.append(field)
|
| 21 |
else:
|
| 22 |
parsed_row.append(field)
|