Skip to content

Tag: python

Split columns by space or dash – python

I have a pandas df with mixed formatting for a specific column. It contains the qtr and year. I’m hoping to split this column into separate columns. But the formatting contains a space or a second dash between qtr and year. I’m hoping to include a function that splits the column by a blank space o…

How to display the nearest station with the distance in a database

The train station dataframe is in this format: The house dataframe is in this format i manage to find the closest station to each flat in distance, but how can i include a column which indicates what the closest station is Here is the code that i did to find the shortest distance, but i cant seems to find a