Skip to content

Instantly share code, notes, and snippets.

@dottyz
Created May 2, 2019 18:30
Show Gist options
  • Save dottyz/4647a6df16019f130bc6a9468d1aac64 to your computer and use it in GitHub Desktop.
Save dottyz/4647a6df16019f130bc6a9468d1aac64 to your computer and use it in GitHub Desktop.
stations_start = df[['from_station_id', 'from_station_name']]
stations_end = df[['to_station_id', 'to_station_name']]
stations_start.columns = stations_end.columns = ['station_id', 'name']
# Extracts the unique station ID and name combination from the from_station and to_station columns
stations = pd.concat([stations_start, stations_end]).dropna(how='all').drop_duplicates().reset_index(drop=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment