Iterable<String>, CategoricalColumn, Column, StringFilters, StringMapFunctions, StringReduceUtilspublic class StringColumn extends AbstractColumn implements CategoricalColumn, StringFilters, StringMapFunctions, StringReduceUtils
Because the MISSING_VALUE for this column type is an empty string, there is little or no need for special handling of missing values in this class's methods.
| Modifier and Type | Field | Description |
|---|---|---|
StringColumnReference |
column |
|
static String |
MISSING_VALUE |
DEFAULT_ARRAY_SIZE| Modifier and Type | Method | Description |
|---|---|---|
StringColumn |
addAll(List<String> stringValues) |
Add all the strings in the list to this column
|
StringColumn |
append(String value) |
Added for naming consistency with all other columns
|
void |
append(Column column) |
|
StringColumn |
appendCell(String object) |
|
StringColumn |
appendMissing() |
Appends a missing value appropriate to the column
|
byte[] |
asBytes(int rowNumber) |
Returns the contents of the cell at rowNumber as a byte[]
|
double[] |
asDoubleArray() |
|
List<String> |
asList() |
Returns a List<String> representation of all the values in this column
|
NumberColumn |
asNumberColumn() |
|
Set<String> |
asSet() |
|
List<String> |
bottom(int n) |
Returns the smallest ("bottom") n values in the column
|
int |
byteSize() |
Returns the width of a cell in this column, in bytes.
|
void |
clear() |
|
boolean |
contains(String aString) |
Returns true if this column contains a cell with the given string, and false otherwise
|
static String |
convert(String stringValue) |
|
StringColumn |
copy() |
Returns a deep copy of the receiver
|
Table |
countByCategory() |
|
int |
countMissing() |
Returns the count of missing values in this column
|
double |
countOccurrences(String value) |
|
int |
countUnique() |
Returns the count of unique values in this column.
|
static StringColumn |
create(String name) |
|
static StringColumn |
create(String name,
int size) |
|
static StringColumn |
create(String name,
String[] strings) |
|
static StringColumn |
create(String name,
List<String> strings) |
|
it.unimi.dsi.fastutil.ints.IntArrayList |
data() |
Returns the integers that back this column.
|
StringColumn |
emptyCopy() |
Returns a copy of the receiver with no data.
|
StringColumn |
emptyCopy(int rowSize) |
Returns an empty copy of the receiver, with its internal storage initialized to the given row size.
|
int |
firstIndexOf(String value) |
|
String |
get(int rowIndex) |
Returns the value at rowIndex in this column.
|
double |
getDouble(int i) |
Returns a double representation of the value at the given row.
|
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)
|
StringColumnFormatter |
getPrintFormatter() |
|
String |
getString(int row) |
Returns a string representation of the value at the given row.
|
String |
getUnformattedString(int row) |
|
it.unimi.dsi.fastutil.ints.IntArrayList |
getValues(it.unimi.dsi.fastutil.ints.IntArrayList indexes) |
Returns all the values associated with the given indexes.
|
void |
initializeWith(it.unimi.dsi.fastutil.ints.IntArrayList list,
StringColumn old) |
Initializes this Column with the given values for performance
|
boolean |
isEmpty() |
Returns true if the column has no data
|
Selection |
isEqualTo(String string) |
|
Selection |
isIn(String... strings) |
|
boolean |
isMissing(int rowNumber) |
|
Selection |
isNotEqualTo(String string) |
|
Selection |
isNotIn(String... strings) |
|
Iterator<String> |
iterator() |
|
it.unimi.dsi.fastutil.ints.Int2ObjectMap<String> |
keyToValueMap() |
|
StringColumn |
lag(int n) |
Returns a column of the same type and size as the receiver, containing the receivers values offset by n.
|
StringColumn |
lead(int n) |
Returns a column of the same type as the receiver, containing the receivers values offset -n
For example if you lead a column containing 2, 3, 4 by 1, you get a column containing 3, 4, NA.
|
StringColumn |
removeMissing() |
|
it.unimi.dsi.fastutil.ints.IntComparator |
rowComparator() |
|
StringColumn |
set(int rowIndex,
String stringValue) |
|
StringColumn |
set(String newValue,
Selection rowSelection) |
Conditionally update this column, replacing current values with newValue for all rows where the current value
matches the selection criteria
|
void |
setPrintFormatter(StringColumnFormatter formatter) |
|
int |
size() |
Returns the number of elements (a.k.a.
|
void |
sortAscending() |
|
void |
sortDescending() |
|
Table |
summary() |
|
List<String> |
top(int n) |
Returns the largest ("top") n values in the column
|
ColumnType |
type() |
Returns this column's ColumnType
|
StringColumn |
unique() |
Returns a new Column containing all the unique values in this column
|
static boolean |
valueIsMissing(String string) |
|
it.unimi.dsi.fastutil.ints.IntArrayList |
values() |
Returns the integer encoded value of each cell in this column.
|
StringColumn |
where(Filter filter) |
|
StringColumn |
where(Selection selection) |
columnWidth, name, print, setName, toStringcolumnWidth, create, first, inRange, last, name, print, rolling, rows, sampleN, sampleX, setName, subset, summarizeIf, titleforEach, spliteratorclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcontainsString, endsWith, equalsIgnoreCase, equalsIgnoreCase, eval, eval, eval, eval, isAlpha, isAlphaNumeric, isEmptyString, isEqualTo, isIn, isLongerThan, isLowerCase, isMissing, isNotEqualTo, isNotIn, isNotMissing, isNumeric, isShorterThan, isUpperCase, lengthEquals, matchesRegex, startsWithabbreviate, commonPrefix, commonSuffix, concatenate, countTokens, distance, format, join, length, lowerCase, padEnd, padStart, replaceAll, replaceAll, replaceFirst, substring, substring, tokenizeAndRemoveDuplicates, tokenizeAndSort, tokenizeAndSort, tokens, trim, uniqueTokens, upperCaseappendAll, appendAllpublic final StringColumnReference column
public static final String MISSING_VALUE
public static boolean valueIsMissing(String string)
public StringColumn appendMissing()
ColumnappendMissing in interface Columnpublic static StringColumn create(String name)
public static StringColumn create(String name, String[] strings)
public static StringColumn create(String name, List<String> strings)
public static StringColumn create(String name, int size)
public ColumnType type()
Columntype in interface Columntype in class AbstractColumnColumnTypepublic void setPrintFormatter(StringColumnFormatter formatter)
public StringColumnFormatter getPrintFormatter()
public String getString(int row)
Columnpublic String getUnformattedString(int row)
getUnformattedString in interface Columnpublic StringColumn emptyCopy()
Columnpublic StringColumn emptyCopy(int rowSize)
Columnpublic void sortAscending()
sortAscending in interface Columnpublic void sortDescending()
sortDescending in interface Columnpublic int size()
public String get(int rowIndex)
get in interface StringFiltersrowIndex - index of the rowIndexOutOfBoundsException - if the given rowIndex is not in the columnpublic List<String> asList()
NOTE: Unless you really need a string consider using the column itself for large datasets as it uses much less memory
public Table countByCategory()
countByCategory in interface CategoricalColumnpublic StringColumn lead(int n)
Columnpublic StringColumn lag(int n)
ColumnFor example if you lag a column containing 2, 3, 4 by 1, you get a column containing NA, 2, 3
public StringColumn set(String newValue, Selection rowSelection)
Examples: myCatColumn.set("Dog", myCatColumn.isEqualTo("Cat")); // no more cats myCatColumn.set("Fox", myCatColumn.valueIsMissing()); // no more missing values
public StringColumn set(int rowIndex, String stringValue)
public int countUnique()
ColumncountUnique in interface Columnpublic List<String> top(int n)
n - The maximum number of records to return. The actual number will be smaller if n is greater than the
number of observations in the columnpublic List<String> bottom(int n)
n - The maximum number of records to return. The actual number will be smaller if n is greater than the
number of observations in the columnpublic void initializeWith(it.unimi.dsi.fastutil.ints.IntArrayList list,
StringColumn old)
public boolean contains(String aString)
aString - the value to look forpublic it.unimi.dsi.fastutil.ints.IntArrayList getValues(it.unimi.dsi.fastutil.ints.IntArrayList indexes)
indexes - the indexesIntArrayListpublic StringColumn addAll(List<String> stringValues)
stringValues - a list of valuespublic StringColumn appendCell(String object)
appendCell in interface ColumnappendCell in class AbstractColumnpublic it.unimi.dsi.fastutil.ints.IntComparator rowComparator()
rowComparator in interface Columnpublic boolean isEmpty()
Columnpublic Selection isEqualTo(String string)
isEqualTo in interface StringFilterspublic List<BooleanColumn> getDummies()
BooleanColumnpublic StringColumn unique()
public it.unimi.dsi.fastutil.ints.IntArrayList data()
IntArrayListpublic NumberColumn asNumberColumn()
public StringColumn where(Selection selection)
public StringColumn where(Filter filter)
where in interface StringFilterspublic StringColumn copy()
Columnpublic int countMissing()
countMissing in interface Columnpublic StringColumn removeMissing()
removeMissing in interface Columnpublic it.unimi.dsi.fastutil.ints.IntArrayList values()
IntArrayListpublic int byteSize()
Columnpublic byte[] asBytes(int rowNumber)
public double getDouble(int i)
Columnpublic double[] asDoubleArray()
asDoubleArray in interface Columnpublic StringColumn append(String value)
public Selection isIn(String... strings)
isIn in interface StringFilterspublic Selection isNotIn(String... strings)
isNotIn in interface StringFilterspublic it.unimi.dsi.fastutil.ints.Int2ObjectMap<String> keyToValueMap()
public int firstIndexOf(String value)
public double countOccurrences(String value)
Copyright © 2018. All rights reserved.