Home assignment 3#
Last updated: 2024-11-02 16:00:13
Question 1#
Read the
'education.csv'
file into aDataFrame
object.Calculate and print a new table, where each row represents a type of education facility, with the following columns:
'type'
—Facility type
'count'
—Total number of facilities of that type
'valid_address'
—The percent of facilities with a valid address (i.e., other thannp.nan
). The values should be strings of the form'86.1%'
(with one decimal).
type | count | valid_address | |
---|---|---|---|
0 | בית ספר | 65 | 84.6% |
1 | גן ילדים | 395 | 83.3% |
2 | חווה חקלאי | 1 | 0.0% |
3 | מרכז מדעים | 2 | 50.0% |
4 | על יסודי | 26 | 69.2% |
Question 2#
The text file named
'bgu.wkt'
(see Sample data) contains a WKT string representing the geometry of the BGU logo.Read the WKT string from the
'bgu.wkt'
file, using theopen
and.readline
methods (see Working with files). Convert the string into ashapely
geometryNote: Do not copy and paste the WKT string into your code! You need to read it from the
'bgu.wkt'
file.Display the logo graphically.
Calculate the area of the logo.
0.21286694897980007
Calculate a circle that is enclosing the logo. To do that, first calculate the average of x-axis bounds and the average of the y-axis bounds, then construct a point according to those x and y values, and finally buffer the point to a distance of your choice so that the logo is completely within the buffer.
Calculate the geometry of the difference between the logo and the bouding circle you calculated, then plot it.