<s> import numpy as np <EOL> from bokeh . palettes import Spectral6 <EOL> def process_data ( ) : <EOL> from bokeh . sampledata . gapminder import fertility , life_expectancy , population , regions <EOL> columns = list ( fertility . columns ) <EOL> years = list ( range ( int ( columns [ <NUM_LIT:0> ] ) , int ( columns [ - <NUM_LIT:1> ] ) ) ) <EOL> rename_dict = dict ( zip ( columns , years ) ) <EOL> fertility = fertility . rename ( columns = rename_dict ) <EOL> life_expectancy = life_expectancy . rename ( columns = rename_dict ) <EOL> population = population . rename ( columns = rename_dict ) <EOL> regions = regions . rename ( columns = rename_dict ) <EOL> scale_factor = <NUM_LIT:200> <EOL> population_size = np . sqrt ( population / np . pi ) / scale_factor <EOL> min_size = <NUM_LIT:3> <EOL> population_size = population_size . where ( population_size >= min_size ) . fillna ( min_size ) <EOL> regions . Group = regions . Group . astype ( '<STR_LIT>' ) <EOL> regions_list = list ( regions . Group . cat . categories ) <EOL> def get_color ( r ) : <EOL> return Spectral6 [ regions_list . index ( r . Group ) ] <EOL> regions [ '<STR_LIT>' ] = regions . apply ( get_color , axis = <NUM_LIT:1> ) <EOL> return fertility , life_expectancy , population_size , regions , years , regions_list </s>
