Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Python
  3. Question
Python

How to coerce a list object to type 'double'

Asked by Diane Carr Apr 3, 2021 918 views 1 answer
Share

About this question

 The code:
                                 "37
 Can (list) object cannot be coerced to type 'double' be solved? 
To convert a list of object to numeric, you can use the unlist() function to convert it to a vector, and then use as.numeric() to convert it into a vector.i.e.,
                                  "374")), .Names = "X$Days")
 
class(unlist(a))
[1] "character"
as.numeric(unlist(a))
[1]  10  38  66 101 129 185 283 374

========================================================================
Question 4 - What asset is used to build a remarketing list?
Question description - -Custom Metric
-Custom Report
-Custom Dimension
-Custom Segment
Top keywords - what asset is used to build a remarketing list?
Answer -
The correct answer to what asset is used to build a remarketing list? is the option (4) Custom Segment. Custom Segment is utilized to build a remarketing list.), .Names = "X$Days")
a <- structure(list(`X$Days` = c("10", "38", "66", "101", "129", "185", "283", "37 Can (list) object cannot be coerced to type 'double' be solved? To convert a list of object to numeric, you can use the unlist() function to convert it to a vector, and then use as.numeric() to convert it into a vector.i.e., a <- structure(list(`X$Days` = c("10", "38", "66", "101", "129", "185", "283", "374")), .Names = "X$Days")
a <- structure(list(`X$Days` = c("10", "38", "66", "101", "129", "185", "283", 
                                 "37
 Can (list) object cannot be coerced to type 'double' be solved? 
To convert a list of object to numeric, you can use the unlist() function to convert it to a vector, and then use as.numeric() to convert it into a vector.i.e.,
a <- structure(list(`X$Days` = c("10", "38", "66", "101", "129", "185", "283", 
                                  "374")), .Names = "X$Days")
 
Then a is like
$`X$Days`
[1] "10"  "38"  "66"  "101" "129" "185" "283" "374"
I would like to coerce a to an array of numeric values, but coercing functions return me
Error: (list) object cannot be coerced to type 'double'
Thanks,aa
a <- structure(list(`X$Days` = c("10", "38", "66", "101", "129", "185", "283", 
a <- structure(list(`X$Days` = c("10", "38", "66", "101", "129", "185", "283", 

Your answer

1 Answer

More Python discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Python Blogs

Guides, tips and career advice on Python from JanBask experts.