geobr icon indicating copy to clipboard operation
geobr copied to clipboard

Cannot import "read_statistical_grid" function

Open tp-duarte opened this issue 2 years ago • 1 comments

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.

tp-duarte avatar May 14 '22 22:05 tp-duarte

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

rafapereirabr avatar May 15 '22 13:05 rafapereirabr

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?

vss-2 avatar May 17 '23 15:05 vss-2

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?

rafapereirabr avatar May 18 '23 15:05 rafapereirabr

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

  • the first will fix the typos in grid_state_correspondence_table.csv
  • the following one will add the read_statistical_grid() function

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 avatar May 18 '23 21:05 vss-2

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

vss-2 avatar May 19 '23 14:05 vss-2

@JoaoCarabetta , what do you think?

rafapereirabr avatar May 19 '23 17:05 rafapereirabr

closed with PR 320

rafapereirabr avatar Nov 27 '23 16:11 rafapereirabr