I got this error message when trying to run the code: code and error message - ufunc 'isnan' not supported for the input types
The relevant dataframe is here: Relevant dataframe
The geojson file is here: https://cocl.us/sanfran_geojson
Any idea why?
Thanks in advance for your help.
I finally figured out the problem. It was because I converted the "Count" column in the dataframe into comma separated format. This inadvertently set the format of the column to object rather than int64.
The choropleth function does not work with object format in the "Count" column.
I unformatted the "Count" column and consequently the format of the column reverted to int64.
It is now working.
Lesson learn: in Python format is supremely important.
Hope this helps!
Related
Hi everyone,
My goal is to remove the integer behind the name (if exist) as shown in the screenshot above. Is there any trick to do this other than doing it manually? It is challenging for me because the name list is not consistent as some of the names does not have integer behind. Any help will be greatly appreciated!
In your situation, how about the following sample formula?
Sample formula:
=ARRAYFORMULA(REGEXREPLACE(A3:A,"\d+$",""))
Result:
Note:
If you want to use TRIM for the value, how about =ARRAYFORMULA(TRIM(REGEXREPLACE(A3:A,"\d+$","")))?
Reference:
REGEXREPLACE
Added:
From OP's following replying,
Hi Tanaike, thanks for your input. I tested both formula. It works most of the time with the exception of Derrick Tan 1. Beside that, is it possible to remove the - as well if exist? I edited my question with new screenshot example, thank you.
In this case, how about the following sample formula?
Sample formula:
=ARRAYFORMULA(TRIM(REGEXREPLACE(A3:A,"[-\s\d]+$","")))
Result:
I am reading an Excel file (see syntax below) where some of the fields are text mixed with numbers. The problem is that SPSS reads some of these fields as numeric instead of string and then the text is deleted.
I assume this happens in cases where a large part of the first rows are empty or with a numeric value and then it defines the variable as numeric.
How can this be avoided?
GET DATA
/TYPE=XLSX
/FILE='M:\MyData.xlsx'
/SHEET=name 'Sheet1'
/CELLRANGE=FULL
/READNAMES=ON
/DATATYPEMIN PERCENTAGE=95.0
/HIDDEN IGNORE=YES.
When you use the get data command, the subcommand /DATATYPEMIN PERCENTAGE=95.0 tells SPSS that if up to 5% of the values in the field do not conform to the selected format it's still ok. So in order to avoid cases where only very few values are text and the field is read as number, you have to correct the subcommand to:
/DATATYPEMIN PERCENTAGE=100
I am using PHPSpreadsheet and am reading in a spreadsheet with the following (working correctly) formula. I'm using Libre Office to generate my spreadsheet.
=SUMIFS($My_sheet.C:C,$My_sheet.B:B,">"&$'Home page'.$I$12,$My_sheet.B:B,"<"&$'Home page'.$I$13)
For some reason when I remove the offending rows my sheet reads/writes perfectly fine but with them I get corrupted files and it throws unreadable files.
I'm not setting the value - this is already in the spreadsheet I'm reading.
I hope this will help someone. I was looking for PhpOffice\PhpSpreadsheet\Calculation\Statistical\Conditional::SUMIFS() as your call.
For the example given simply wrap each , separated section in quotes and pass them to this function. So the answer would be:
use PhpOffice\PhpSpreadsheet\Calculation\Statistical\Conditional as StatCond;
StatCond::SUMIFS('$My_sheet.C:C','$My_sheet.B:B','">"&$\'Home page\'.$I$12','My_sheet.B:B','"<"&$\'Home page\'.$I$13')
I'm reading currency values from a website and I'd like to do some calculations with these numbers. They come in this format:
$7,821.24
Here's an example file:
https://docs.google.com/spreadsheets/d/1vHEH_m16KXcDh7hY_BVG9lur1huFjWOnx5bWtgrdGdA/edit?usp=sharing
Now for some reason neither VALUE() and TO_PURE_NUMBER work for me (Can't parse to numberic value, telling me it's a text value).
My guess is that the comma and the $-sign confuse the formula, is there anything I can do to format this correctly? The dollar sign always appears in the values but the comma only appears separating thousands of values.
I just started using Sheets for this so I absolutely have no clue. Would really appreciate if someone could help me out.
Thanks for your time!
Issue:
It's a locale problem. The value coming from IMPORTXML is formatted as in United States locale, so your spreadsheet (which uses a different format) cannot convert it.
Solution #1. Changing locale:
If the spreadsheet locale is changed to United States or others with the same format (via selecting File > Spreadsheet settings and setting the mentioned locale), the retrieved value will be a number, and you can work with it without using any other formula.
Solution #2. Formula:
If changing the locale is not an option, one possible way to convert the value to a valid number in your locale is the following formula:
=SUBSTITUTE(SUBSTITUTE(RIGHT(A2;LEN(A2)-1);",";"");".";",")
Changing locale didn't work in my case. But I was able to split the number which google sheet isn't detecting as a real number. So split it with "," and "." and any currency sign you may have, and then combine individual values for desired output
I have a problem, during importing data from cube using PowerPivot for Excel.
When I import measures to the PowerPivot workbook, it treats numbers as text. When I try to change datatype to decimal number, I get following error:
The following system error occurred: Type mismatch.
PowerPivot database error: Datatype conversion failed for [Table: 'Query', Column: '', Value: '6198.9357860000009'].
I'm trying to create pivot table with these values, but while it treats numbers as text, I'm not able to create it correctly. Does anyone know how to deal with it ?
I will be grateful for any help.
Regards,
Konrad
I couldn't handle this problem, but I found a workaround.
In PowerPivot window, I added new column and inserted following function:
=VALUE(SUBSTITUTE(Query[MyMeasure],".",",",1))
It replaces "." with "," and treats values as decimal numbers. Then I hid useless column (with text values) and renamed new column with hidden column name.
Finally I figured out, what was the issue. Regional language was set as Polish and default decimal symbol in Polish language was . instead of ,.
I changed regional langauge to english U.S., reponed excel file and now conversion to decimal number is possible.
This may happen when we have NaN values in measures. Divide by zero errors will throw up exactly the same message in PowerPivot.