#NEWLINE# def test_melt( ) : #NEWLINE# #INDENT# pdf = pd . DataFrame ( { #NEWLINE# #INDENT# 'A' : ( list ( 'abcd' ) * 5 ) , #NEWLINE# 'B' : ( list ( 'XY' ) * 10 ) , #NEWLINE# 'C' : np . random . randn ( 20 ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# ddf = dd . from_pandas ( pdf , 4 ) #NEWLINE# list_eq ( dd . melt ( ddf ) , pd . melt ( pdf ) ) #NEWLINE# list_eq ( dd . melt ( ddf , id_vars = 'C' ) , pd . melt ( pdf , id_vars = 'C' ) ) #NEWLINE# list_eq ( dd . melt ( ddf , value_vars = 'C' ) , pd . melt ( pdf , value_vars = 'C' ) ) #NEWLINE# list_eq ( dd . melt ( ddf , value_vars = [ 'A' , 'C' ] , var_name = 'myvar' ) , pd . melt ( pdf , value_vars = [ 'A' , 'C' ] , var_name = 'myvar' ) ) #NEWLINE# list_eq ( dd . melt ( ddf , id_vars = 'B' , value_vars = [ 'A' , 'C' ] , value_name = 'myval' ) , pd . melt ( pdf , id_vars = 'B' , value_vars = [ 'A' , 'C' ] , value_name = 'myval' ) )