Skip to content

Instantly share code, notes, and snippets.

@joseberlines
Last active February 21, 2021 23:17
Show Gist options
  • Save joseberlines/10b0ac486d67a4aa3c2d6fd9c77ebb9a to your computer and use it in GitHub Desktop.
Save joseberlines/10b0ac486d67a4aa3c2d6fd9c77ebb9a to your computer and use it in GitHub Desktop.
rails_df['speed_int']=rails_df['speed'].str.replace('km/h','').astype('int')
min_speed = rails_df['speed_int'].min()
max_speed = rails_df['speed_int'].max()
span_speed = max_speed-min_speed
rails_df['score'] = rails_df['speed_int'].apply(lambda x: (x-min_speed)/span_speed)
rails_df['width'] = rails_df['score'] *7 +5
G=transform_into_ipycytoscape(stations_df,rails_df)
display(G)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment