program python

dn PythonList at DancesWithMice.info
Thu Mar 4 15:53:07 EST 2021


Hi, and welcome to the list.

On 05/03/2021 09.36, alberto wrote:
> Hi I'm tring to write a program with python to evaluate data of csv data
> In particular I would extract this information 
> 
> View data on the presence of men and women in Affori over time.
> 
> * Carry out an analysis relating to the last available year. Of the 10 most populous neighborhoods show:
> * the proportion of births out of the total
> * the proportion of 80+ to the total
> * The ratio of minors / number of kindergartens
> 
> this is the file
> https://drive.google.com/file/d/1zKflvSpB-oDAqYscLsEgUhSnqL1XPdql/view?usp=sharing
> 
> How could fix it?


NB For security reasons, many will not follow this link/see the data-file!

There are several libraries which can be import-ed into Python, which
enable access to .csv-formatted files. The PSL (Python Standard Library)
offers "csv — CSV File Reading and Writing"
(https://docs.python.org/3/library/csv.html).

Start by writing the Python code to open the .csv file, and close it
again (as you would at the end of the program). Leave plenty of
blank/empty lines between the two, and use that space to continue with
the next steps...

There are three objectives.

To start, assume that the file is open in front of you. How will you
solve the first problem? Can you describe this in English (and/or your
preferred language)?

Write this as a Python comment. Next, can you translate the
spoken-language into Python?

Thereafter tackle problems two and three.


We don't know your level of Python skill. So, let us know how you
get-on, and come back with sample code, if you strike a problem at any step.
-- 
Regards,
=dn


More information about the Python-list mailing list