program python
alberto
voodoo.bender at gmail.com
Fri Mar 5 05:41:30 EST 2021
Il giorno giovedì 4 marzo 2021 alle 23:51:39 UTC+1 Igor Korot ha scritto:
> Hi,
> On Thu, Mar 4, 2021 at 4:42 PM alberto <voodoo... at gmail.com> wrote:
> >
> > Il giorno giovedì 4 marzo 2021 alle 22:04:57 UTC+1 Paul Bryan ha scritto:
> > > I don't see a Python program in that link.
> > >
> > > Are you asking how to extract data from a CSV?
> > > A good start will be to look into the csv.reader function and
> > > csv.DictReader class.
> > >
> > > Paul
> > > On Thu, 2021-03-04 at 12:36 -0800, 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?
> > > >
> > > > regards
> >
> > Hi,
> > with this code
> > import pandas as pd
> > df = pd.read_csv('data.csv',usecols=['Uomini','Donne'])
> >
> > print(df)
> > I extract two columns, but I would see 'Affori over time'
> And if you add this column to the list - what happens?
> Thank you.
>
> >
> > regards
> > --
> > https://mail.python.org/mailman/listinfo/python-list
Hi,
with pandas I obtain results!
Now I would calculate ratio beetween columns of my csv
import pandas as pd
pd.set_option('display.max_rows', 500)
df = pd.read_csv ('data_quartiere_2018.csv', usecols= ['Anno','Totale','Quartiere','Nati','80 e più soli','80 e più','Minori','Scuola_infanzia (numero)'])
test = df.loc[df['Totale'] >= 31990,
print (test)
in particular I would calculate ratio beetween ('Nati'*100)/'Totale' when ['Totale'] >= 31990
How could fix it
More information about the Python-list
mailing list