There are several ways of knowing the length of your dataframe rows. Here are three ways using index, shape and count methods.
Manually inspecting this dataframe below, we see that it has 10 rows (note the index count starts from 0). Now, let check for this information dynamically.
1) index
Using the index method, it returns the 'RangeIndex' start, stop and step for the dataframe. So, wrapping it in a len() function will give the stop value that is the length of the datafarme as seen below.
2) shape
Using the shape method will return a tuple like so (row, col), where the first element is row and the second element is column.
3) count
Using the count method returns a 'pandas.core.series.Series' that contains number of items for each column.
Enjoy!
Tuesday, June 23, 2020
Thursday, June 18, 2020
SVG2GeoJSON - SVG file with added Geo-Referencing
Recently, I had a task to convert an SVG image map into GeoJSON format for use in the GIS. This is a complicated thing to do because SVG vector images don't have spatial reference.
Fortunately, I stumbled on this NodeJS app package named svg2geojson written by Prognoz. This library converts an SVG image to a (slightly-incorrect) GeoJSON
To make use of this library, you need to update your SVG map by placing two 'GeoItems' inside a Prognoz MetaInfo element as a direct child of the '<svg>' element at the root of your document.
Now how do you find the X/Y and Longitude/Latitude attributes within the 'GeoItems' for your specific SVG image? This question is what I will attempt to answer in this blog post.
That is something like the daigram below:-