Dear stackoverflow community,
This is my first time asking a question here. Hope you could cut me some slack. Here is the description of a problem:
- I convert KML file to CSV using ogr2org
ogr2ogr -f CSV output.csv 'some KML file'.kml - I then read in the csv file in pandas
data = pd.read_csv('output.csv')
- After deleting some bizarre columns I end up having the following:
In[1]: data.head(8)
Out[1]:
description ID
0 <div class="googft-info-window">\n<b>ID:</b> 1... 1
1 <div class="googft-info-window">\n<b>ID:</b> 1... 10
2 <div class="googft-info-window">\n<b>ID:</b> 1... 100
3 <div class="googft-info-window">\n<b>ID:</b> 1... 1000
4 <div class="googft-info-window">\n<b>ID:</b> 1... 10000
5 <div class="googft-info-window">\n<b>ID:</b> 1... 10001
6 <div class="googft-info-window">\n<b>ID:</b> 1... 10002
7 <div class="googft-info-window">\n<b>ID:</b> 1... 10003
- The representative string under description variable is as follows:
<div class=""googft-info-window"">
<b>ID:</b> 1<br>
<b>class:</b> 1<br>
<b>fold:</b> 5
</div>
My question is how can I extract clean information from the 'description' column and add it to the same row using all the <b>...<\b> as a column names.
Thank you. P.S. Please let me know how I can improve my questions in the future.