@@ -347,7 +347,7 @@ def __init__(self, data=None, index=None, columns=None, dtype=None,
347347 elif isinstance (data , (np .ndarray , Series , Index )):
348348 if data .dtype .names :
349349 data_columns = list (data .dtype .names )
350- data = dict (( k , data [k ]) for k in data_columns )
350+ data = { k : data [k ] for k in data_columns }
351351 if columns is None :
352352 columns = data_columns
353353 mgr = self ._init_dict (data , index , columns , dtype = dtype )
@@ -417,8 +417,7 @@ def _init_dict(self, data, index, columns, dtype=None):
417417 extract_index (list (data .values ()))
418418
419419 # prefilter if columns passed
420- data = dict ((k , v ) for k , v in compat .iteritems (data )
421- if k in columns )
420+ data = {k : v for k , v in compat .iteritems (data ) if k in columns }
422421
423422 if index is None :
424423 index = extract_index (list (data .values ()))
@@ -3895,7 +3894,7 @@ def f(col):
38953894 return self ._constructor_sliced (r , index = new_index ,
38963895 dtype = r .dtype )
38973896
3898- result = dict (( col , f (col )) for col in this )
3897+ result = { col : f (col ) for col in this }
38993898
39003899 # non-unique
39013900 else :
@@ -3906,7 +3905,7 @@ def f(i):
39063905 return self ._constructor_sliced (r , index = new_index ,
39073906 dtype = r .dtype )
39083907
3909- result = dict (( i , f (i )) for i , col in enumerate (this .columns ))
3908+ result = { i : f (i ) for i , col in enumerate (this .columns )}
39103909 result = self ._constructor (result , index = new_index , copy = False )
39113910 result .columns = new_columns
39123911 return result
@@ -3984,7 +3983,7 @@ def _compare_frame_evaluate(self, other, func, str_rep, try_cast=True):
39843983 if self .columns .is_unique :
39853984
39863985 def _compare (a , b ):
3987- return dict (( col , func (a [col ], b [col ])) for col in a .columns )
3986+ return { col : func (a [col ], b [col ]) for col in a .columns }
39883987
39893988 new_data = expressions .evaluate (_compare , str_rep , self , other )
39903989 return self ._constructor (data = new_data , index = self .index ,
@@ -3993,8 +3992,8 @@ def _compare(a, b):
39933992 else :
39943993
39953994 def _compare (a , b ):
3996- return dict (( i , func (a .iloc [:, i ], b .iloc [:, i ]) )
3997- for i , col in enumerate (a .columns ))
3995+ return { i : func (a .iloc [:, i ], b .iloc [:, i ])
3996+ for i , col in enumerate (a .columns )}
39983997
39993998 new_data = expressions .evaluate (_compare , str_rep , self , other )
40003999 result = self ._constructor (data = new_data , index = self .index ,
0 commit comments