<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Convert a pandas DataFrame to GeoJSON (Stations)
In this Python snippet we use stations (geographic) from the Swiss public transportation and convert the data to a GeoJSON (http
Step1:  Now we do some data cleaning and remove all rows where Longitude and Latitude are 'null'.
Step2:  Convert pandas data frame to GeoJSON
Next we convert the panda data frame to geosjon objects (FeatureCollection/Feature/Point).
Step3:  Save the GeoJSON (FeatureCollection)  to a file
Finally we dump the GeoJSON objects to a file.
<ASSISTANT_TASK:>
Python Code:
import pandas as pd
df = pd.read_csv('data/bfkoordgeo_utf8.csv')
df.head()
Explanation: Convert a pandas DataFrame to GeoJSON (Stations)
In this Python snippet we use stations (geographic) from the Swiss public transportation and convert the data to a GeoJSON (http://geojson.org/) file.
Donwload the 'bfkoordgeo.csv' file, https://opentransportdata.swiss/en/dataset/bhlist/resource/b92a372f-7843-4ddd-b1c6-c9c6397e1097
Convert the file from ISO-8859-1 to UTF-8
iconv -f ISO-8859-1 -t UTF-8 bfkoordgeo.csv &gt; out.csv
Note: The data is from the Open Data Platform Swiss Public Transport, https://opentransportdata.swiss/en/
Required libraries
pandas, http://pandas.pydata.org/
geojson, https://pypi.python.org/pypi/geojson/
Load the data
First let's load the data with pandas. The data frame contains the stations from the public transportations from Switzerland and some from adjoining countries. We have the columns:
- StationID
- Longitude
- Latitude
- Height
- Remark
Longitude and Latitude should be WGS 84 coordinates.
End of explanation
df = df[df['Longitude'].notnull()]
df = df[df['Latitude'].notnull()]
# will display all rows that have null values
#df[df.isnull().any(axis=1)]
Explanation: Now we do some data cleaning and remove all rows where Longitude and Latitude are 'null'.
End of explanation
import geojson as geojson
values = zip(df['Longitude'], df['Latitude'], df['Remark'])
points = [geojson.Feature(geometry=geojson.Point((v[0], v[1])), properties={'name': v[2]}) for v in values]
geo_collection = geojson.FeatureCollection(points)
print(points[0])
Explanation: Convert pandas data frame to GeoJSON
Next we convert the panda data frame to geosjon objects (FeatureCollection/Feature/Point).
End of explanation
dump = geojson.dumps(geo_collection, sort_keys=True)
'''
with open('stations.geojson', 'w') as file:
    file.write(dump)
'''
Explanation: Save the GeoJSON (FeatureCollection)  to a file
Finally we dump the GeoJSON objects to a file.
End of explanation
<END_TASK>