File tree Expand file tree Collapse file tree 3 files changed +33
-23
lines changed Expand file tree Collapse file tree 3 files changed +33
-23
lines changed Original file line number Diff line number Diff line change 1
1
name = " CatBoost"
2
2
uuid = " e2e10f9a-a85d-4fa9-b6b2-639a32100a12"
3
3
authors = [" Beacon Biosignals, Inc." ]
4
- version = " 0.1.0 "
4
+ version = " 0.1.1 "
5
5
6
6
[deps ]
7
7
Conda = " 8f4d0f93-b110-5947-807f-2305c1781a2d"
Original file line number Diff line number Diff line change @@ -6,6 +6,20 @@ using DataFrames
6
6
using OrderedCollections
7
7
using Tables
8
8
9
+ # ####
10
+ # #### Exports
11
+ # ####
12
+
13
+ export catboost
14
+
15
+ export CatBoostRegressor, CatBoostClassifier
16
+ export fit!, cv, predict, predict_proba
17
+ export Pool
18
+ export pandas_to_df
19
+
20
+ # Datasets API.
21
+ export load_dataset
22
+
9
23
# ####
10
24
# #### _init_
11
25
# ####
@@ -137,9 +151,8 @@ function pandas_to_df(pandas_df::PyObject)
137
151
ret = c isa PyObject ? PyAny (c) : c
138
152
return ret isa Int ? ret + 1 : ret
139
153
end
140
- # Did the creators of PyCall seriously handle the conversion automatically?
141
- # What were they thinking?
142
- df = DataFrame (Any[Array (pandas_df[c]. values) for c in colnames], map (Symbol, colnames))
154
+ df = DataFrame (Any[Array (getproperty (pandas_df, c). values) for c in colnames],
155
+ map (Symbol, colnames))
143
156
return df
144
157
end
145
158
@@ -152,18 +165,4 @@ function load_dataset(dataset_name::Symbol)
152
165
return train, test
153
166
end
154
167
155
- # ####
156
- # #### Exports
157
- # ####
158
-
159
- export catboost
160
-
161
- export CatBoostRegressor, CatBoostClassifier
162
- export fit!, cv, predict, predict_proba
163
- export Pool
164
- export pandas_to_df
165
-
166
- # Datasets API.
167
- export load_dataset
168
-
169
168
end # module
Original file line number Diff line number Diff line change 1
- using Test, CatBoost, Aqua
1
+ using Test, CatBoost, DataFrames, PyCall
2
+ using Aqua
2
3
3
4
EXAMPLES_DIR = joinpath (@__DIR__ , " .." , " examples" )
4
5
5
- for ex in readdir (EXAMPLES_DIR)
6
- @testset " $ex " begin
7
- # Just check the examples run, for now.
8
- include (joinpath (EXAMPLES_DIR, ex))
6
+ @testset " `to_pandas` and `pandas_to_df`" begin
7
+ df = DataFrame (; floats= 0.5 : 0.5 : 3.0 , ints= 1 : 6 )
8
+ pd = CatBoost. to_pandas (df)
9
+ @test pd isa PyObject
10
+ df2 = pandas_to_df (pd)
11
+ @test df2 == df
12
+ end
13
+
14
+ @testset " Examples" begin
15
+ for ex in readdir (EXAMPLES_DIR)
16
+ @testset " $ex " begin
17
+ # Just check the examples run, for now.
18
+ include (joinpath (EXAMPLES_DIR, ex))
19
+ end
9
20
end
10
21
end
11
22
You can’t perform that action at this time.
0 commit comments