Questions tagged [ordinal]

An ordinal is a mathematical designation of position or ordering.

Ordinals differ from cardinals in that cardinals denote size or cadinality (there are 5 apples) while ordinals denote position or ordering (this is the fifth apple). Both are concepts are closely related to the natural numbers as well as programming, particularly with regard to the implementation of data structures (e.g. determining the size of a collection of the position of a specific element).

318 questions
694
votes
9 answers

Difference between InvariantCulture and Ordinal string comparison

When comparing two strings in c# for equality, what is the difference between InvariantCulture and Ordinal comparison?
Kapil
  • 9,469
  • 10
  • 40
  • 53
384
votes
17 answers

Cast Int to enum in Java

What is the correct way to cast an Int to an enum in Java given the following enum? public enum MyEnum { EnumValue1, EnumValue2 } MyEnum enumValue = (MyEnum) x; //Doesn't work???
Maxim Gershkovich
  • 45,951
  • 44
  • 147
  • 243
184
votes
23 answers

How do you format the day of the month to say "11th", "21st" or "23rd" (ordinal indicator)?

I know this will give me the day of the month as a number (11, 21, 23): SimpleDateFormat formatDayOfMonth = new SimpleDateFormat("d"); But how do you format the day of the month to include an ordinal indicator, say 11th, 21st or 23rd?
Ken Hume
  • 1,935
  • 2
  • 13
  • 7
70
votes
3 answers

Do C++ enums Start at 0?

If I have an enum that does not assign numbers to the enumerations, will it's ordinal value be 0? For example: enum enumeration { ZERO, ONE, TWO, THREE, FOUR, …
Jonathan Mee
  • 37,899
  • 23
  • 129
  • 288
35
votes
2 answers

What does the name of the ord() function stand for?

The official Python documentation explains ord(c) ord(c): Given a string representing one Unicode character, return an integer representing the Unicode code point of that character. For example, ord('a') returns the integer 97 and ord('€') (Euro…
AbstProcDo
  • 19,953
  • 19
  • 81
  • 138
23
votes
3 answers

KNN classification with categorical data

I'm busy working on a project involving k-nearest neighbor (KNN) classification. I have mixed numerical and categorical fields. The categorical values are ordinal (e.g. bank name, account type). Numerical types are, for e.g. salary and age. There…
Graham
  • 541
  • 2
  • 5
  • 13
21
votes
10 answers

Pipeline OrdinalEncoder ValueError Found unknown categories

Please take it easy on me. I’m switching careers into data science and don’t have a CS or programming background—so I could be doing something profoundly stupid. I've researched for a few hours without success. Objective: get Pipeline to run with…
Pablo Honey
  • 311
  • 1
  • 2
  • 5
20
votes
1 answer

Interpretation of .L, .Q., .C, .4… for logistic regression

I've done a good amount of googling and the explanations either don't make any sense or they say just use factors instead of ordinal data. I understand that the ``.Lis linear,.Q` is quadratic, ... etc. But I don't know how to actually say what it…
hubertsng
  • 419
  • 2
  • 4
  • 14
16
votes
2 answers

Convert a string to ordinal upper or lower case

Is it possible to convert a string to ordinal upper or lower case. Similar like invariant. string upperInvariant = "ß".ToUpperInvariant(); string lowerInvariant = "ß".ToLowerInvariant(); bool invariant = upperInvariant == lowerInvariant; //…
Wouter
  • 2,540
  • 19
  • 31
16
votes
1 answer

How can I call a exported function using ordinal number

If a dll exports some functions and the functions have only ordinal numbers, how can I call the functions? Give me a short example please.
Benjamin
  • 10,085
  • 19
  • 80
  • 130
14
votes
1 answer

D3 linechart, can't edit the amount of ticks with an ordinal scale?

I asked a question before about d3, and they suggested me to use an ordinal scale, this would solve my problems. Indeed it solved my problems, but know I'm stuck with another issue... It draws perfectly, but my X-axis is full of text. As an…
Vincent Hogendoorn
  • 700
  • 1
  • 7
  • 23
10
votes
3 answers

Access columns of a table by index instead of name in SQL Server stored procedure

Is there a way to access columns by their index within a stored procedure in SQL Server? The purpose is to compute lots of columns. I was reading about cursors, but I do not know how to apply them. Let me explain my problem: I have a row…
edgarmtze
  • 24,683
  • 80
  • 235
  • 386
9
votes
0 answers

Using `ordinal::clmm` model to make predictions on new data

I have some repeated measures, ordinal response data: dat <- data.frame( id = factor(sample(letters[1:5], 50, replace = T)), response = factor(sample(1:7, 50, replace = T), ordered = T), x1 = runif(n = 50, min = 1, max = 10), x2 = runif(n =…
jrudd
  • 91
  • 2
9
votes
2 answers

D3 linechart string domain x-axis

I'm relatively new to D3, and I can't figure out why something isn't working. I want to draw a line-chart with d3, and this works fine, but I have problems with the axes. With the following code it goes wrong somewhere and I don't see how to…
Vincent Hogendoorn
  • 700
  • 1
  • 7
  • 23
8
votes
2 answers

Getting ordinal from function name programmatically

What's the easiest way in C++ to get an ordinal of an exported dll function, given its name? (Looking for a way which doesn't invlove parsing the IATs myself...)
Danra
  • 9,546
  • 5
  • 59
  • 117
1
2 3
21 22