Orange Forum • View topic - Very strange type conversion

Very strange type conversion

Report bugs (or imagined bugs).
(Archived/read-only, please use our ticketing system for reporting bugs and their discussion.)
Forum rules
Archived/read-only, please use our ticketing system for reporting bugs and their discussion.

Very strange type conversion

Postby bgbg » Wed Oct 14, 2009 13:00

This is my data file:
Code: Select all
target   param0   param1
discrete   d   c
class      
negative   0   0
positive   0   1


This is my test code. Note the strange conversion to float in line 134

Code: Select all
In [131]: data = orange.ExampleTable('test.tab')

In [132]: data[0]
Out[132]: ['0', 0, 'negative']

In [133]: str(data[0][0])
Out[133]: '0'

In [134]: float(data[0][0])
Out[134]: 2.0

In [135]: str(data[0][1])
Out[135]: '0'

In [136]: float(data[0][1])
Out[136]: 0.0




WTF?

Postby Ales » Thu Oct 15, 2009 10:16

Casting to numerical types of discrete values returns the index of the value not the actual numerical representation (which in general isn't known).

Postby bgbg » Thu Oct 15, 2009 15:42

I see, thanks.


Return to Bugs



cron