def denormalize_column_names(parsed_data):
 cols = parsed_data.columns.tolist()
 base_columns = defaultdict(list)
 for col in cols:
  if ('.' in col):
   base_columns[col].append(col.split('.')[(-1)])
 rename = {}
 for (col, new_cols) in iteritems(base_columns):
  if (len(new_cols) == 1):
   rename[col] = new_cols[0]
 if (len(list(rename.keys())) > 0):
  return parsed_data.rename(columns=rename)
 else:
  return parsed_data

def denormalize_column_names ( parsed_data ) : cols = parsed_data . columns . tolist ( ) base_columns = defaultdict ( list ) for col in cols : if ( '.' in col ) : base_columns [ col ] . append ( col . split ( '.' ) [ ( - 1 ) ] ) rename = { } for ( col , new_cols ) in iteritems ( base_columns ) : if ( len ( new_cols ) == 1 ) : rename [ col ] = new_cols [ 0 ] if ( len ( list ( rename . keys ( ) ) ) > 0 ) : return parsed_data . rename ( columns = rename ) else : return parsed_data
attempts to remove the column hierarchy if possible when parsing from json .