Package tech.tablesaw.columns.strings
Class IntDictionaryMap
- java.lang.Object
-
- tech.tablesaw.columns.strings.IntDictionaryMap
-
- All Implemented Interfaces:
Iterable<String>
,DictionaryMap
,StringFilters
,StringReduceUtils
,FilterSpec<Selection>
,StringFilterSpec<Selection>
public class IntDictionaryMap extends Object implements DictionaryMap
A map that supports reversible key value pairs of int-String
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
IntDictionaryMap.IntDictionaryBuilder
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
append(String value)
void
appendMissing()
byte[]
asBytes(int rowNumber)
Returns the contents of the cell at rowNumber as a byte[]String[]
asObjectArray()
Set<String>
asSet()
boolean
canPromoteToText()
void
clear()
Table
countByCategory(String columnName)
int
countMissing()
Returns the count of missing values in this columnint
countOccurrences(String value)
int
countUnique()
boolean
equals(Object o)
int
firstIndexOf(String value)
List<BooleanColumn>
getDummies()
Returns a list of boolean columns suitable for use as dummy variables in, for example, regression analysis, select a column of categorical data must be encoded as a list of columns, such that each column represents a single category and indicates whether it is present (1) or not present (0)int
getKeyAtIndex(int rowNumber)
Returns the int that represents the string at rowNumberit.unimi.dsi.fastutil.ints.Int2IntMap.FastEntrySet
getKeyCountEntries()
int
getKeyForIndex(int rowIndex)
it.unimi.dsi.fastutil.objects.ObjectSet<it.unimi.dsi.fastutil.ints.Int2ObjectMap.Entry<String>>
getKeyValueEntries()
String
getValueForIndex(int rowIndex)
String
getValueForKey(int key)
int
hashCode()
Selection
isEqualTo(String string)
boolean
isMissing(int rowNumber)
Iterator<String>
iterator()
int
nextKeyWithoutIncrementing()
DictionaryMap
promoteYourself()
Selection
selectIsIn(String... strings)
Selection
selectIsIn(Collection<String> strings)
void
set(int rowIndex, String stringValue)
int
size()
Returns the number of elements (a.k.a.void
sortAscending()
void
sortDescending()
it.unimi.dsi.fastutil.ints.IntArrayList
values()
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface tech.tablesaw.columns.strings.DictionaryMap
asIntArray, get, isEmpty, isIn, isIn, isNotEqualTo, isNotIn, isNotIn, uniqueValuesAt
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface tech.tablesaw.columns.strings.StringFilters
containsString, endsWith, equalsIgnoreCase, equalsIgnoreCase, eval, eval, eval, eval, isAlpha, isAlphaNumeric, isEmptyString, isEqualTo, isIn, isLongerThan, isLowerCase, isMissing, isNotEqualTo, isNotIn, isNotMissing, isNumeric, isShorterThan, isUpperCase, lengthEquals, matchesRegex, startsWith, startsWith
-
Methods inherited from interface tech.tablesaw.columns.strings.StringReduceUtils
appendAll, appendAll
-
-
-
-
Method Detail
-
size
public int size()
Returns the number of elements (a.k.a. rows or cells) in the column- Specified by:
size
in interfaceDictionaryMap
- Specified by:
size
in interfaceStringFilters
- Specified by:
size
in interfaceStringReduceUtils
-
values
public it.unimi.dsi.fastutil.ints.IntArrayList values()
-
getKeyCountEntries
public it.unimi.dsi.fastutil.ints.Int2IntMap.FastEntrySet getKeyCountEntries()
-
getKeyValueEntries
public it.unimi.dsi.fastutil.objects.ObjectSet<it.unimi.dsi.fastutil.ints.Int2ObjectMap.Entry<String>> getKeyValueEntries()
-
getValueForIndex
public String getValueForIndex(int rowIndex)
- Specified by:
getValueForIndex
in interfaceDictionaryMap
-
getKeyForIndex
public int getKeyForIndex(int rowIndex)
- Specified by:
getKeyForIndex
in interfaceDictionaryMap
-
sortAscending
public void sortAscending()
- Specified by:
sortAscending
in interfaceDictionaryMap
-
getKeyAtIndex
public int getKeyAtIndex(int rowNumber)
Returns the int that represents the string at rowNumber- Specified by:
getKeyAtIndex
in interfaceDictionaryMap
-
getValueForKey
public String getValueForKey(int key)
- Specified by:
getValueForKey
in interfaceDictionaryMap
-
sortDescending
public void sortDescending()
- Specified by:
sortDescending
in interfaceDictionaryMap
-
countOccurrences
public int countOccurrences(String value)
- Specified by:
countOccurrences
in interfaceDictionaryMap
-
asSet
public Set<String> asSet()
- Specified by:
asSet
in interfaceDictionaryMap
-
firstIndexOf
public int firstIndexOf(String value)
- Specified by:
firstIndexOf
in interfaceDictionaryMap
-
asObjectArray
public String[] asObjectArray()
- Specified by:
asObjectArray
in interfaceDictionaryMap
-
countUnique
public int countUnique()
- Specified by:
countUnique
in interfaceDictionaryMap
-
selectIsIn
public Selection selectIsIn(String... strings)
- Specified by:
selectIsIn
in interfaceDictionaryMap
-
selectIsIn
public Selection selectIsIn(Collection<String> strings)
- Specified by:
selectIsIn
in interfaceDictionaryMap
-
append
public void append(String value) throws NoKeysAvailableException
- Specified by:
append
in interfaceDictionaryMap
- Throws:
NoKeysAvailableException
-
set
public void set(int rowIndex, String stringValue) throws NoKeysAvailableException
- Specified by:
set
in interfaceDictionaryMap
- Throws:
NoKeysAvailableException
-
clear
public void clear()
- Specified by:
clear
in interfaceDictionaryMap
-
countByCategory
public Table countByCategory(String columnName)
- Specified by:
countByCategory
in interfaceDictionaryMap
-
isEqualTo
public Selection isEqualTo(String string)
- Specified by:
isEqualTo
in interfaceDictionaryMap
- Specified by:
isEqualTo
in interfaceStringFilters
- Specified by:
isEqualTo
in interfaceStringFilterSpec<Selection>
-
getDummies
public List<BooleanColumn> getDummies()
Returns a list of boolean columns suitable for use as dummy variables in, for example, regression analysis, select a column of categorical data must be encoded as a list of columns, such that each column represents a single category and indicates whether it is present (1) or not present (0)- Specified by:
getDummies
in interfaceDictionaryMap
- Returns:
- a list of
BooleanColumn
-
asBytes
public byte[] asBytes(int rowNumber)
Returns the contents of the cell at rowNumber as a byte[]- Specified by:
asBytes
in interfaceDictionaryMap
-
countMissing
public int countMissing()
Returns the count of missing values in this column- Specified by:
countMissing
in interfaceDictionaryMap
-
iterator
public Iterator<String> iterator()
- Specified by:
iterator
in interfaceDictionaryMap
- Specified by:
iterator
in interfaceIterable<String>
-
appendMissing
public void appendMissing()
- Specified by:
appendMissing
in interfaceDictionaryMap
-
isMissing
public boolean isMissing(int rowNumber)
- Specified by:
isMissing
in interfaceDictionaryMap
-
promoteYourself
public DictionaryMap promoteYourself()
- Specified by:
promoteYourself
in interfaceDictionaryMap
-
nextKeyWithoutIncrementing
public int nextKeyWithoutIncrementing()
- Specified by:
nextKeyWithoutIncrementing
in interfaceDictionaryMap
-
canPromoteToText
public boolean canPromoteToText()
- Specified by:
canPromoteToText
in interfaceDictionaryMap
-
-