Agroalimentary (2 points) ========================= From the Catalan Government web we have downloaded the file :download:`agroalimentary.csv` related to Catalan agroalimentary companies, that you already know. We have extended it with a randomly generated column named ``Facturacio`` showing the company billing in thousands of euros (:py:class:`int`). Download and study this file. We have already created a :py:ref:`DataFrame ` with this data. The following example shows the names of all the columns of this :py:ref:`DataFrame `, then a subdataframe example with columns corresponding to the company name (``Establiment``), the region (``Comarca``), the company type (``Titularitat``) and the billing (``Facturacio``), and, below, the same subdataframe with colums ``Establiment`` and ``Sector``: .. literalinclude:: test-agroalim1.txt :language: python :lines: 4-31 Save the two following functions to file ``agroalim.py``. #. Write function :py:func:`agroalim1` that takes a :py:ref:`DataFrame `, ``dfagro``, as that described and a string (:py:class:`str`) corresponding to a region, ``'Comarca'``, and returns a dictionary (:py:class:`dict`) in which keys are company types, ``'Titularitat'`` (:py:class:`str`), and values are the number of companies of this type, corresponding to the given region (1 point). Examples: .. literalinclude:: test-agroalim1.txt :language: python :lines: 36-41 .. note:: You have more tests in file :download:`test-agroalim1.txt` .. hint:: Use selection, methods ``groupby`` and ``size`` and function ``dict``. #. Write function :py:func:`agroalim2` that takes a :py:ref:`DataFrame `, ``dfagro``, as that described, and two values (:py:class:`int`) corresponding to two billings, :math:`b1` and :math:`b2`, such that :math:`b1`.