#NEWLINE# @ pytest . mark . skipif ( ( LooseVersion ( pd . __version__ ) <= '0.18.0' ) , reason = 'pd.core.dtypes does not exist' ) #NEWLINE# def test_dataframe_categoricals( ) : #NEWLINE# #INDENT# df = pd . DataFrame ( { #NEWLINE# #INDENT# 'x' : list ( ( ( ( 'a' * 5 ) + ( 'b' * 5 ) ) + ( 'c' * 5 ) ) ) , #NEWLINE# 'y' : range ( 15 ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# df . x = df . x . astype ( 'category' ) #NEWLINE# ddf = dd . from_pandas ( df , npartitions = 2 ) #NEWLINE# assert ( ddf . x . cat . categories == pd . Index ( [ 'a' , 'b' , 'c' ] ) ) . all ( ) #NEWLINE# assert ( not hasattr ( ddf . y , 'cat' ) )