@@ -439,24 +439,26 @@ end
439
439
440
440
@testitem " PyPandasDataFrame" begin
441
441
using Tables
442
+ using DataFrames
443
+ using CondaPkg
444
+ CondaPkg. add (" pandas" )
442
445
@test PyPandasDataFrame isa Type
443
- # TODO : figure out how to get pandas into the test environment
444
- # for now use some dummy type and take advantage of the fact that the code doesn't actually check it's a real dataframe
445
- @pyexec """
446
- class DataFrame:
447
- def __init__(self, **kw):
448
- self.__dict__.update(kw)
449
- """ => DataFrame
450
- df = DataFrame (shape = ( 4 , 3 ), columns = pylist ([ " foo " , " bar " , " baz " ]) )
451
- x = PyPandasDataFrame (df )
446
+ x = (x = [ 1 , 2 , 3 ], y = [ " a " , " b " , " c " ])
447
+ py_df = pytable (x, :pandas )
448
+ @test Tables . istable ( PyTable (py_df))
449
+ df = DataFrame ( PyTable (py_df))
450
+ @test df == DataFrame (x = [ 1 , 2 , 3 ], y = [ " a " , " b " , " c " ])
451
+
452
+ x = PyPandasDataFrame (py_df)
453
+ df = DataFrame (x )
454
+ @test df == DataFrame (x = [ 1 , 2 , 3 ], y = [ " a " , " b " , " c " ] )
452
455
@test ispy (x)
453
- @test Py (x) === df
454
456
@test Tables. istable (x)
455
457
@test Tables. columnaccess (x)
456
- @test_throws Exception Tables. columns (x)
458
+ @test Tables. columns (x)[ :x ] == [ 1 , 2 , 3 ]
457
459
@test_throws Exception pyconvert (PyPandasDataFrame, 1 )
458
460
str = sprint (show, MIME (" text/plain" ), x)
459
- @test occursin (r" 4×3 .*PyPandasDataFrame" , str)
461
+ @test occursin (r" 3×2 .*PyPandasDataFrame" , str)
460
462
end
461
463
462
464
@testitem " PySet" begin
0 commit comments