the-magnificents / 04-02-2021-Carpentry-for-HGIS

A carpentry workshop focused on Digital Humanities audience that works with Geospatial Data.
Other
2 stars 3 forks source link

04-02-2021-Carpentry-for-HGIS/02_Day_2_Python_GIS/exercise/B2_Exercise #75

Open utterances-bot opened 3 years ago

utterances-bot commented 3 years ago

Pandas dataframes — Python essentials for GIS learners

https://the-magnificents.github.io/04-02-2021-Carpentry-for-HGIS/02_Day_2_Python_GIS/exercise/B2_Exercise.html

cforgaci commented 3 years ago

Exercise: Selection of Individual Values

The GDP per capita of Serbia in 2007 was:
gdpPercap_2007    9786.534714
Name: Serbia, dtype: float64

Exercise: Extent of Slicing

  1. not the same output
  2. named slicing seems to be inclusive of the end item, whereas slicing with indices excludes the last item

Exercise: Reconstructing Data

Exercise: Selecting Indices

Note,myString should be my_string in the following code:

my_string = 'Hello world!'   # creation of a string object 
dir(myString)
jurra commented 3 years ago

@cforgaci here goes a version of the function where we can print only the gdp number:

def get_gdp(country, year):
    gdp = data.loc[country, years == year]
    print("The GDP per capita of ", country, " in ", year, " was:\n", gdp[0], sep='')

This specifies to get only the value in the series, this selection would only have one item, being at position 0.

cforgaci commented 3 years ago

@jurra, thanks! Ha, interesting, you received that message. I thought it was lost, as I cannot see it in the comments on the website.

On 16 Mar 2021, at 17:42, Jose Carlos Urra Llanusa @.***> wrote:

@cforgaci https://github.com/cforgaci here goes a version of the function where we can print only the gdp number:

def get_gdp(country, year): gdp = data.loc[country, years == year] print("The GDP per capita of ", country, " in ", year, " was:\n", gdp[0], sep='') — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/the-magnificents/04-02-2021-Carpentry-for-HGIS/issues/75#issuecomment-800425205, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIALFAAVVU2MTXXZNHSAPXTTD6C5ZANCNFSM4ZI3TRGQ.

jurra commented 3 years ago

@cforgaci Maybe you just have to refresh the page

cforgaci commented 3 years ago

@jurra, I tried, also restarted my browser. Actually, I cannot see your replies to this thread on the web page either. Is this only me?

On 16 Mar 2021, at 18:12, Jose Carlos Urra Llanusa @.***> wrote:

@cforgaci https://github.com/cforgaci Maybe you just have to refresh the page

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/the-magnificents/04-02-2021-Carpentry-for-HGIS/issues/75#issuecomment-800449920, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIALFAFJXVLR6BC6E4I32YLTD6GRLANCNFSM4ZI3TRGQ.

jurra commented 3 years ago

That is probably because somehow its being cached, and presenting you old versions of the website. If you try in an incognito window it should work.

jurra commented 3 years ago

@cforgaci I am wrong, actually I was expecting this behavior, but things are a bit more complex, the comments will show in the website only when they are written in the website.