@@ -40,13 +40,29 @@ def __repr__(self):
40
40
"""
41
41
return "Hello, I am a neural net trainer!"
42
42
43
- def read_csv (self , file ):
43
+ def read_csv (self , file , ** kargs ):
44
44
"""
45
- Reads a CSV file into a Pandas DataFrame
45
+ Reads a CSV file into a Pandas DataFrame
46
+ You can use all the usual read_csv keywords
47
+ e.g. reading only first few rows or choosing a specific delimiter
46
48
"""
47
49
from pandas import read_csv
48
50
49
- df = read_csv (file )
51
+ df = read_csv (file ,** kargs )
52
+ self .df = df
53
+
54
+ return self .df
55
+
56
+ def read_html (self , url ,** kargs ):
57
+ """
58
+ Reads a HTML table into the internal (Pandas) DataFrame
59
+ (For now) this only works for a single table on the HTML page.
60
+ """
61
+ from pandas import read_html
62
+
63
+ df = read_html (url ,** kargs )[0 ]
64
+ if 'Unnamed: 0' in df .columns :
65
+ df .drop ('Unnamed: 0' ,axis = 1 ,inplace = True )
50
66
self .df = df
51
67
52
68
return self .df
@@ -580,4 +596,4 @@ def model_in_plain_english(self):
580
596
print ("Activation function:" , d [i ]["config" ]["activation" ])
581
597
print ("-" * 40 )
582
598
print (f"In total, there are { total_param } parameters in this model!" )
583
- print ()
599
+ print ()
0 commit comments