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