Iterable<String>
, Comparator<String>
, CategoricalColumn<String>
, Column<String>
, StringFilters
, StringMapFunctions
, StringReduceUtils
, FilterSpec<String>
, StringFilterSpec<String>
public class StringColumn extends AbstractStringColumn<StringColumn>
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.
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
|
StringColumn |
append(Column<String> column) |
Appends all the values in the argument to the bottom of this column and return this column
|
StringColumn |
appendCell(String object) |
Add one element to the bottom of this column and set its value to the parsed value of the given
String.
|
StringColumn |
appendCell(String object,
AbstractColumnParser<?> parser) |
Add one element to the bottom of this column and set its value to the parsed value of the given
String, as performed by the given parser
|
StringColumn |
appendMissing() |
Appends a missing value appropriate to the column
|
StringColumn |
appendObj(Object obj) |
Appends the given value to the bottom of this column and return this column
|
byte[] |
asBytes(int rowNumber) |
Returns the contents of the cell at rowNumber as a byte[]
|
double[] |
asDoubleArray() |
|
DoubleColumn |
asDoubleColumn() |
|
List<String> |
asList() |
Returns a List<String> representation of all the values in this column
|
String[] |
asObjectArray() |
Returns an array of objects as appropriate for my type of column
|
Set<String> |
asSet() |
Returns a Set containing all the unique values in this column
|
StringColumn |
asStringColumn() |
Returns a StringColumn consisting of the (unformatted) String representation of this column
values
|
TextColumn |
asTextColumn() |
|
void |
clear() |
Removes all elements TODO: Make this return this column
|
boolean |
contains(String aString) |
Returns true if this column contains a cell with the given string, and false otherwise
|
StringColumn |
copy() |
Returns a deep copy of the receiver
|
Table |
countByCategory() |
Returns a count of the number of elements in each category (i.e., the number of repetitions of
each value) TODO: This needs to be well tested, especially for IntColumn
|
int |
countMissing() |
Returns the count of missing values in this column
|
int |
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,
Collection<String> strings) |
|
static StringColumn |
create(String name,
Stream<String> stream) |
|
static StringColumn |
createInternal(String name,
DictionaryMap map) |
|
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.
|
DictionaryMap |
getDictionary() |
For tablesaw internal use only
|
double |
getDouble(int i) |
|
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)
|
boolean |
isEmpty() |
Returns true if the column has no data
|
Selection |
isEqualTo(String string) |
|
Selection |
isIn(String... strings) |
|
Selection |
isIn(Collection<String> strings) |
|
boolean |
isMissing(int rowNumber) |
Returns true if the value at rowNumber is missing
|
Selection |
isNotEqualTo(String string) |
|
Selection |
isNotIn(String... strings) |
|
Selection |
isNotIn(Collection<String> strings) |
|
Iterator<String> |
iterator() |
|
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() |
Returns a copy of this column with the missing values removed
|
it.unimi.dsi.fastutil.ints.IntComparator |
rowComparator() |
Returns an IntComparator for sorting my rows
|
StringColumn |
set(int rowIndex,
String stringValue) |
Sets the value at index row to the given value and return this column
|
StringColumn |
set(Selection rowSelection,
String newValue) |
Conditionally update this column, replacing current values with newValue for all rows where the
current value matches the selection criteria
|
StringColumn |
setMissing(int i) |
Sets the value at index i to the missing-value indicator for this column type, and return this
column
|
int |
size() |
Returns the number of elements (a.k.a.
|
void |
sortAscending() |
Sorts my values in ascending order
|
void |
sortDescending() |
Sorts my values in descending order
|
Table |
summary() |
Returns a table containing a ColumnType specific summary of the data in this column
|
StringColumn |
unique() |
Returns a new Column containing all the unique values in this column
|
static boolean |
valueIsMissing(String string) |
|
StringColumn |
where(Selection selection) |
Returns a new column containing the subset referenced by the
Selection |
filter, first, indexOf, inRange, last, map, max, min, name, parser, sampleN, sampleX, set, setName, setParser, sorted, subset, toString, type
append, bottom, byteSize, compare, getPrintFormatter, getString, getUnformattedString, set, setPrintFormatter, top
allMatch, anyMatch, columnWidth, count, count, filter, first, indexOf, inRange, interpolate, last, map, map, mapInto, max, max, min, min, name, noneMatch, parser, print, reduce, reduce, rolling, sampleN, sampleX, set, set, set, setMissingTo, setName, setParser, sorted, subset, title, type
comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
forEach, spliterator
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
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
abbreviate, capitalize, commonPrefix, commonSuffix, concatenate, concatenate, countTokens, distance, format, join, length, lowerCase, padEnd, padStart, parseDouble, parseFloat, parseInt, repeat, replaceAll, replaceAll, replaceFirst, substring, substring, tokenizeAndRemoveDuplicates, tokenizeAndSort, tokenizeAndSort, tokens, trim, uniqueTokens, upperCase
appendAll, appendAll
public static boolean valueIsMissing(String string)
public StringColumn appendMissing()
Column
public static StringColumn create(String name)
public static StringColumn create(String name, String... strings)
public static StringColumn create(String name, Collection<String> strings)
public static StringColumn createInternal(String name, DictionaryMap map)
public static StringColumn create(String name, int size)
public static StringColumn create(String name, Stream<String> stream)
public boolean isMissing(int rowNumber)
Column
public StringColumn emptyCopy()
AbstractColumn
emptyCopy
in interface Column<String>
emptyCopy
in class AbstractColumn<StringColumn,String>
Column
public StringColumn emptyCopy(int rowSize)
Column
rowSize
- the initial row sizeColumn
public void sortAscending()
Column
public void sortDescending()
Column
public int size()
public String get(int rowIndex)
rowIndex
- 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 summary()
Column
public Table countByCategory()
CategoricalColumn
public void clear()
Column
public StringColumn lead(int n)
Column
public StringColumn lag(int n)
Column
For example if you lag a column containing 2, 3, 4 by 1, you get a column containing NA, 2, 3
public StringColumn set(Selection rowSelection, String newValue)
Examples: myCatColumn.set(myCatColumn.isEqualTo("Cat"), "Dog"); // no more cats myCatColumn.set(myCatColumn.valueIsMissing(), "Fox"); // no more missing values
set
in interface Column<String>
set
in class AbstractColumn<StringColumn,String>
public StringColumn set(int rowIndex, String stringValue)
Column
public int countUnique()
Column
public boolean contains(String aString)
aString
- the value to look forpublic StringColumn setMissing(int i)
Column
public StringColumn addAll(List<String> stringValues)
stringValues
- a list of valuespublic StringColumn appendCell(String object)
Column
public StringColumn appendCell(String object, AbstractColumnParser<?> parser)
Column
public it.unimi.dsi.fastutil.ints.IntComparator rowComparator()
Column
public boolean isEmpty()
Column
public List<BooleanColumn> getDummies()
BooleanColumn
public StringColumn unique()
public DoubleColumn asDoubleColumn()
public StringColumn where(Selection selection)
Column
Selection
public StringColumn copy()
Column
Column
public StringColumn append(Column<String> column)
Column
public int countMissing()
public StringColumn removeMissing()
Column
public Set<String> asSet()
Column
public byte[] asBytes(int rowNumber)
rowNumber
- index of the rowpublic double getDouble(int i)
public double[] asDoubleArray()
public StringColumn append(String value)
public StringColumn appendObj(Object obj)
Column
public Selection isIn(Collection<String> strings)
public Selection isNotIn(Collection<String> strings)
public int firstIndexOf(String value)
public int countOccurrences(String value)
public String[] asObjectArray()
Column
public StringColumn asStringColumn()
AbstractColumn
asStringColumn
in interface Column<String>
asStringColumn
in class AbstractColumn<StringColumn,String>
StringColumn
built using the column Column.getUnformattedString(int)
methodpublic TextColumn asTextColumn()
public DictionaryMap getDictionary()
Copyright © 2021. All rights reserved.