question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

numbers as categories should equal their string representations

See original GitHub issue

I would expect this to generate 3 categories (a, b, 1) but it generates 4 - two identical 1’s:

Plotly.newPlot(gd,[{x:['a','b',1,'1'],y:[1,2,3,4]}],{xaxis:{type:'category'}})
screen shot 2017-03-09 at 7 03 14 pm

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
monferacommented, Mar 10, 2017

Generally I’m not an advocate of automatic type coercions so if asked yesterday, I’d have said, expecting 4 things would seem natural. Coercing to strings will make it sort them as strings by default, e.g. “2” > “10”. But based on the above discussion it looks like coercion would be the more natural fit for the library and I have no overriding argument of any kind.

0reactions
etpinardcommented, Mar 30, 2018

Found this. Will be fixed as part of https://github.com/plotly/plotly.js/pull/2489

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Numbers Classes - Java Tutorials
Returns an integer, given a string representation of decimal, binary, octal, or hexadecimal ( radix equals 10, 2, 8, or 16 respectively) numbers...
Read more >
Transforming Categorical Data | Machine Learning
You can represent categorical values as strings or even numbers, but you won't be able to compare these numbers or subtract them from...
Read more >
How to determine whether a string represents a numeric value
In this article. To determine whether a string is a valid representation of a specified numeric type, use the static TryParse method that...
Read more >
Categorical data — pandas 1.5.2 documentation
Equality semantics​​ Two instances of CategoricalDtype compare equal whenever they have the same categories and order. When comparing two unordered categoricals, ...
Read more >
How can I change a string variable into a numeric variable?
Another way to recode gender, or any string variable for which you want a numeric representation of the categories, is to use the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found