77import numpy as np
88import pandas as pd
99
10- from .data import generate_data
10+ from .data import generate_data , read_csv
1111
1212EMPTY_DF = lambda : pd .DataFrame (
1313 {
1818)
1919
2020
21- def process (
21+ def processing (
2222 file_input ,
2323 force_run ,
2424 test_equation ,
@@ -43,30 +43,10 @@ def process(
4343):
4444 """Load data, then spawn a process to run the greet function."""
4545 if file_input is not None :
46- # Look at some statistics of the file:
47- df = pd .read_csv (file_input )
48- if len (df ) == 0 :
49- return (
50- EMPTY_DF (),
51- "The file is empty!" ,
52- )
53- if len (df .columns ) == 1 :
54- return (
55- EMPTY_DF (),
56- "The file has only one column!" ,
57- )
58- if len (df ) > 10_000 and not force_run :
59- return (
60- EMPTY_DF (),
61- "You have uploaded a file with more than 10,000 rows. "
62- "This will take very long to run. "
63- "Please upload a subsample of the data, "
64- "or check the box 'Ignore Warnings'." ,
65- )
66-
67- col_to_fit = df .columns [- 1 ]
68- y = np .array (df [col_to_fit ])
69- X = df .drop ([col_to_fit ], axis = 1 )
46+ try :
47+ X , y = read_csv (file_input , force_run )
48+ except ValueError as e :
49+ return (EMPTY_DF (), str (e ))
7050 else :
7151 X , y = generate_data (test_equation , num_points , noise_level , data_seed )
7252
0 commit comments