ipeaGIT / geobr

Easy access to official spatial data sets of Brazil in R and Python
https://ipeagit.github.io/geobr/
786 stars 118 forks source link

Cannot import "read_statistical_grid" function #287

Closed tp-duarte closed 9 months ago

tp-duarte commented 2 years ago

Hi there,

I'm trying to import the read_statistical_grid function, but the following error comes out :

ImportError: cannot import name 'read_statistical_grid' from 'geobr' (C:\Users\user-07\miniconda3\lib\site-packages\geobr__init__.py)

My system version :

Python = 3.9.5 geobr = 0.1.10 Windows 10

Obs. : This geobr version was the last one that I tried, but it didn't worked with the default version that it's installed via pip.

rafapereirabr commented 2 years ago

Hi @tp-duarte, the read_statistical_grid() function has not yet been translated to the Python version of geobr. See here.

vss-2 commented 1 year ago

Hello guys, I want to contribute to this project. I have some experience both in R and Python. Just to confirm before submitting a PR: there's a typo in ("Pernanbuco") grid_state_correspondence_table.csv lines linked below

https://github.com/ipeaGIT/geobr/blob/0f829bb2c590222ad686ed42a375a3344b91afed/python-package/geobr/data/grid_state_correspondence_table.csv?plain=1#L61

In grid_state_correspondence_table.RData (r-package equivalent) there's no typo (can't paste link because it is a binary), but I haven't compared the entire file. Is there a way to ensure both are equal?

rafapereirabr commented 1 year ago

Hi @vss-2 . Thanks for the heads up. Indeed, there is a typo in the grid_state_correspondence_table.csv in the Python package. Are you planning to create a pull request to fix this typo? Or are you planning to create a pull request to add the read_statistical_grid() function to the Python package?

vss-2 commented 1 year ago

Thanks for the suggestion, I'm going to create two pull requests:

In addiction to my previous comment, after running print(grid_state_correspondence_table) in R,

             name_state abbrev_state code_grid
1                  Acre           AC     ID_50
...

I've noticed that column names are different in Python grid_state_correspondence_table.csv

name_uf,code_state,code_grid
Acre,AC,ID_50
...

As it seems to be the current project pattern, I will also modify the columns names to:

name_uf -> name_state
code_state -> abbrev_state
vss-2 commented 1 year ago

Hello, after running make prepare-push ./Makefile, following the contributor tutorial https://github.com/ipeaGIT/geobr/blob/c9787a742b099373c10939173995a974e187f62c/python-package/README.md?plain=1#L39 My commit was flooded with 60 indentation fixes by python's black package. Since I had not change anything on these files, am I allowed to ignore the fixes and commit only the function implementation and test? image

rafapereirabr commented 1 year ago

@JoaoCarabetta , what do you think?

rafapereirabr commented 9 months ago

closed with PR 320