Home assignment 3

Home assignment 3#

Last updated: 2026-02-12 16:07:35

Question 1#

  • Read the 'education.csv' file into a DataFrame 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 than np.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 the open and .readline methods (see Working with files). Convert the string into a shapely geometry

  • Note: 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.

_images/080af4c1bf653d89d2a02a6d49cafebdb97d27c0b002ce52eebd79900aa5dfd3.svg
  • Calculate and plot a GeometryCollection with the bounding boxes (also known as envelopes) of the parts of the logo.

  • Note: you can’t use any specific geometry indices, and you can’t assume that the logo has 3 parts—the code needs to be general to work on a geometry with any number of parts.

_images/f0e37d47f329b51525dff98e20210e069500019b60bf3a042a5c48f8d6a6c5b8.svg
  • Hint: you can use the .envelope method (Table 20) to calculate the envelope geometries