Comments (5)
@ivanlen I suspect that a Google spreadsheet's locale settings determine not just the default display formatting of numbers and dates, but also the parsing format rules when interpreting cell value inputs that are in mode USER_ENTERED
.
Would you be willing to try the following:
-
Manually change the locale for this Google spreadsheet to "United States". With the sheet open in a browser, visit File->Spreadsheet settings. Then run your Python script again and see if the float values are parsed correctly as floats.
-
If everything works fine for your script once spreadsheet locale is "United States", then post here what your original locale was, and we will proceed from there.
(I suspect the solution to the problem will be either:
A) Allow overrides to the valueInputOption
value included in Sheets API cell updates; currently the package uses USER_ENTERED
to take advantage of the powerful value parsing logic in Sheets, but it's apparently that some users need to bypass USER_ENTERED.
B) Add locale awareness to set_with_dataframe in some fashion, so that formatting inputs using values from the dataframe take the expected locale of the spreadsheet into consideration.)
from gspread-dataframe.
@ivanlen Release 3.1.1 with this fix ya está en PyPI. Gracias por su ayuda!
from gspread-dataframe.
Hey @robin900 , thanks for your reply.
If I change the locale settings of the spreadsheet to US everything works as expected.
The location that causes the bug was Spain. I am actually from Argentina and if a set settings to Argentina the problem persists as well. I suspect there is something with the Spanish language and formatting. Probably any Country that speaks Spanish will have the same behavior.
I am currently in the middle of some projects, but If I have some free time I will inspect the source code of your project and see if I can implement any of your solutions.
I the meantime, I set the locale to US.
from gspread-dataframe.
@ivanlen He subido un PR #30 que arregla el problema con locales no de EEUU, sin causar regresiones en el paquete de pruebas. Este PR soluciona el problema para valores numéricos pero no para valores de fecha/datetime. Creo que una solución para valores de fecha/datetime no debe ser incluido en el PR porque 1) no hace falta en este momento porque str(alguna_fecha)
ahora produce un string que se puede leer bajo casi todos los locales comunes; y 2) una solución para valores de fecha/datetime tendrá que ser acompañada de pruebas adicionales y completas.
Si tienes un momento y pudieras revisar y probar este PR, te lo agradecería!
from gspread-dataframe.
Hey @robin900 , sorry that I wasn't able to test it before! But Im glad that my Issue helps to improve the overall quality of the package. I will update my version to 3.1.1
Thank you for maintaining this repo,
Cheers from Argentina ;)
from gspread-dataframe.
Related Issues (20)
- Bug: escaping when allow_formulas = False is not returning any value HOT 1
- set_with_dataframe: TypeError: Object of type 'int64' is not JSON serializable HOT 2
- Sheets API erroneously rejects new rowCount if (new rowCount * old columnCount) > 5000000 (was: Bug in the number of cells of the dataframe HOT 4
- Cannot use gspread's add_row() method before using set_with_dataframe() HOT 8
- Can't import, "No module named gspread.models" HOT 1
- Consider allowing option to drop duplicates in set_with_dataframe HOT 4
- Data gets interpreted even when using dtype=str HOT 1
- ModuleNotFoundError: No module named 'gspread.models' HOT 7
- Write header rows for DataFrames with MultiIndex columns so that Pandas reads them properly HOT 1
- Include formatting options in set_with_dataframe
- Consider offering a reader/writer object based on a given dataframe
- return API response from set_with_dataframe HOT 5
- No module named 'gspread' HOT 2
- Feature Request: Append feature to an existing sheet. HOT 1
- Max Cell Count
- Requests to sheets API cause 400 error is worksheet name is valid cell reference (was: Error using get_as_dataframe) HOT 1
- Newest version gspread not compatible HOT 7
- get_as_dataframe() is reading the whole sheet data HOT 1
- Advice to update just one column of a DataFrame in a worksheet (was: ValueError when trying to set a single column) HOT 1
- get dataframe does not work with non-programatically created sheets HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gspread-dataframe.