| 构造器 | 说明 |
|---|---|
DataFrame() |
Constructor
|
DataFrame(List index) |
Constructor
|
DataFrame(List<ucar.ma2.Array> data,
List index,
List columns) |
Constructor
|
DataFrame(List<ucar.ma2.Array> data,
Index index,
List<String> columns) |
Constructor
|
DataFrame(List<ucar.ma2.Array> data,
Index index,
ColumnIndex columns) |
Constructor
|
DataFrame(ColumnIndex columns) |
Constructor
|
DataFrame(Index index) |
Constructor
|
DataFrame(Index index,
List<String> columns,
Object data) |
Constructor
|
DataFrame(Index index,
ColumnIndex columns,
Object data) |
Constructor
|
DataFrame(ucar.ma2.Array data,
List index,
List<String> columns) |
Constructor
|
DataFrame(ucar.ma2.Array data,
Index index,
List<String> columns) |
Constructor
|
DataFrame(ucar.ma2.Array data,
Index index,
ColumnIndex columns) |
Constructor
|
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
void |
addColumn(int loc,
String colName,
Object o) |
Add column data
|
void |
addColumn(int loc,
String colName,
ucar.ma2.Array a) |
Add column data
|
void |
addColumn(int loc,
Column column,
ucar.ma2.Array a) |
Add column data
|
void |
addColumn(String colName,
ucar.ma2.Array a) |
Add column data
|
void |
addColumn(Column column) |
Add column data
|
void |
addColumn(Column column,
Series s) |
Add column data
|
void |
addColumn(Column column,
ucar.ma2.Array a) |
Add column data
|
void |
append(Object name,
List row) |
Append row data
|
DataFrame |
append(DataFrame df) |
Append another data frame
|
<V> DataFrame |
apply(Function<?,?> function) |
Apply a function
|
Object |
clone() |
|
List |
col(Integer column) |
Return a data frame column as a list.
|
DataFrame |
count() |
Compute the sum of the numeric columns.
|
void |
dataReshape(int nrow,
int ncol) |
Data reshape
|
void |
dataToList() |
Convert array 2D to array list.
|
<V> DataFrame |
describe() |
|
DataFrame |
drop(Integer... cols) |
Create a new data frame by leaving out the specified columns.
|
DataFrame |
drop(List<String> colNames) |
Create a new data frame by leaving out the specified columns.
|
DataFrame |
drop(Column... cols) |
Create a new data frame by leaving out the specified columns.
|
ucar.ma2.Array |
getColumnData(int col) |
Get column data array
|
ucar.ma2.Array |
getColumnData(String colName) |
Get column data array
|
List<ucar.ma2.DataType> |
getColumnDataTypes() |
Get column data types
|
List<String> |
getColumnNames() |
Get column names
|
ColumnIndex |
getColumns() |
Get columns
|
Object |
getData() |
Get data array
|
Index |
getIndex() |
Get index
|
int[] |
getShape() |
Get shape
|
Object |
getValue(int row,
int col) |
Get value
|
Object |
getValue(int row,
String colName) |
Get value
|
Object |
getValue(Object row,
Column col) |
Get value
|
DataFrameGroupBy |
groupBy(Integer... columns) |
Group the data frame rows using columns
|
DataFrameGroupBy |
groupBy(Object... columns) |
Group the data frame rows using columns
|
DataFrameGroupBy |
groupBy(List<Object> columns) |
Group the data frame rows using columns
|
DataFrameGroupBy |
groupBy(KeyFunction function) |
Group the data frame rows using the specified key function.
|
DataFrameGroupBy |
groupByIndex(String pStr) |
Group the data frame rows using the specified key function.
|
DataFrameGroupBy |
groupByIndex(WindowFunction function) |
Group the data frame rows using the specified key function.
|
String |
head(int n) |
Convert to string - head
|
boolean |
isArray2D() |
Get if is 2D array
|
boolean |
isEmpty() |
Return
true if the data frame contains no data. |
Iterator |
iterator() |
|
ListIterator<List<Object>> |
iterrows() |
|
int |
length() |
Get the number of rows
|
DataFrame |
max() |
Compute the Maximum of the numeric columns.
|
DataFrame |
mean() |
Compute the mean of the numeric columns.
|
DataFrame |
median() |
Compute the median of the numeric columns.
|
DataFrame |
min() |
Compute the minimum of the numeric columns.
|
DataFrame |
numeric() |
Return a data frame containing only columns with numeric data.
|
static DataFrame |
readTable(String fileName,
String delimiter,
int skipRows,
String formatSpec,
String encoding,
int indexCol,
String indexFormat,
List<String> names,
Integer header,
int skipFooter) |
Read data frame from ASCII file
|
static DataFrame |
readTable(String fileName,
String delimiter,
int skipRows,
String formatSpec,
String encoding,
int indexCol,
String indexFormat,
List<String> names,
Integer header,
int skipFooter,
List<Object> usecolsin) |
Read data frame from ASCII file
|
DataFrame |
retain(Integer... cols) |
Create a new data frame containing only the specified columns.
|
DataFrame |
retain(Object... cols) |
Create a new data frame containing only the specified columns.
|
List |
row(Integer row) |
Return a data frame row as a list.
|
Series |
rowSeries(int row) |
Get row series
|
void |
saveCSV(String fileName,
String delimiter,
String dateFormat,
String floatFormat,
boolean index) |
Save as CSV file
|
Object |
select(int row,
List<Integer> colRange) |
Select by row and column ranges
|
Object |
select(int row,
ucar.ma2.Range colRange) |
Select by row and column ranges
|
Object |
select(List<Integer> rowRange,
List<Integer> colRange) |
Select by row and column ranges
|
Object |
select(List<Integer> rowRange,
ucar.ma2.Range colRange) |
Select by row and column ranges
|
Object |
select(List rowKeys,
List<Integer> rowRange,
List<Integer> colRange) |
Select by row and column ranges
|
Object |
select(List rowKeys,
List<Integer> rowRange,
ucar.ma2.Range colRange) |
Select by row and column ranges
|
Object |
select(ucar.ma2.Range rowRange,
List<Integer> colRange) |
Select by row and column ranges
|
Object |
select(ucar.ma2.Range rowRange,
ucar.ma2.Range colRange) |
Select by row and column ranges
|
void |
setColumn(String colName,
Object a) |
Set column data
|
void |
setColumn(String colName,
ucar.ma2.Array a) |
Set column data
|
void |
setColumns(List<String> colNames) |
Set column names
|
void |
setColumns(ColumnIndex value) |
Set columns
|
void |
setData(List<ucar.ma2.Array> value) |
Set data array
|
void |
setData(ucar.ma2.Array value) |
Set data array
|
void |
setIndex(List value) |
Set index
|
void |
setIndex(Index value) |
Set index
|
void |
setValue(int row,
int col,
Object v) |
Set value
|
void |
setValue(int row,
String colName,
Object v) |
Set value
|
void |
setValue(int row,
Column column,
Object v) |
Set value
|
void |
setValue(Object row,
Column col,
Object v) |
Set value
|
void |
setValues(int row,
ucar.ma2.Range colRange,
Number value) |
Set values by row and column ranges
|
void |
setValues(int row,
ucar.ma2.Range colRange,
ucar.ma2.Array value) |
Set values by row and column ranges
|
int |
size() |
Get the number of columns
|
DataFrame |
sortBy(boolean ascending,
Integer... cols) |
|
DataFrame |
sortBy(Object... cols) |
|
<V> DataFrame |
sortBy(Comparator<List<V>> comparator) |
|
DataFrame |
sortBy(List<String> cols,
List<Boolean> ascendings) |
|
DataFrame |
sortByIndex(boolean ascending) |
|
DataFrame |
sum() |
Compute the sum of the numeric columns.
|
String |
tail(int n) |
Convert to string - tail
|
String |
toString() |
|
DataFrame |
transpose() |
Transpose
|
void |
updateColumnFormats() |
Update columns formats
|
forEach, spliteratorpublic DataFrame()
public DataFrame(ColumnIndex columns)
columns - Columnspublic DataFrame(Index index)
index - Indexpublic DataFrame(List index)
index - Indexpublic DataFrame(ucar.ma2.Array data,
Index index,
ColumnIndex columns)
data - Data arraycolumns - Columnsindex - Indexpublic DataFrame(ucar.ma2.Array data,
Index index,
List<String> columns)
data - Data arraycolumns - Columnsindex - Indexpublic DataFrame(Index index, ColumnIndex columns, Object data)
index - Indexcolumns - Columnsdata - Datapublic DataFrame(Index index, List<String> columns, Object data)
index - Indexcolumns - Columnsdata - Datapublic DataFrame(ucar.ma2.Array data,
List index,
List<String> columns)
data - Data arraycolumns - Columnsindex - Indexpublic DataFrame(List<ucar.ma2.Array> data, Index index, ColumnIndex columns)
data - Data array listcolumns - Columnsindex - Indexpublic DataFrame(List<ucar.ma2.Array> data, Index index, List<String> columns)
data - Data array listcolumns - Columnsindex - Indexpublic Object getData()
public void setData(ucar.ma2.Array value)
value - Data arraypublic void setData(List<ucar.ma2.Array> value)
value - Data arraypublic Index getIndex()
public void setIndex(Index value)
value - Indexpublic void setIndex(List value)
value - Index valuepublic ColumnIndex getColumns()
public List<ucar.ma2.DataType> getColumnDataTypes()
public void setColumns(ColumnIndex value)
value - Columnspublic void setColumns(List<String> colNames)
colNames - Column namespublic boolean isArray2D()
public ListIterator<List<Object>> iterrows()
public void updateColumnFormats()
public int size()
public int length()
public boolean isEmpty()
true if the data frame contains no data.
> DataFrame<Object> df = new DataFrame<>();
> df.isEmpty();
true public List col(Integer column)
> DataFrame<Object> df = new DataFrame<>(
> Collections.emptyList(),
> Arrays.asList("name", "value"),
> Arrays.asList(
> Arrays.<Object>asList("alpha", "bravo", "charlie"),
> Arrays.<Object>asList(1, 2, 3)
> )
> );
> df.col(1);
[1, 2, 3] column - the column indexpublic List row(Integer row)
> DataFrame<Object> df = new DataFrame<>(
> Collections.emptyList(),
> Collections.emptyList(),
> Arrays.asList(
> Arrays.<Object>asList("alpha", "bravo", "charlie"),
> Arrays.<Object>asList(1, 2, 3)
> )
> );
> df.row(1);
[bravo, 2] row - the row indexpublic Series rowSeries(int row)
row - Row indexpublic int[] getShape()
public Object getValue(Object row, Column col)
row - Row objectcol - Column objectpublic Object getValue(int row, int col)
row - Row indexcol - Column indexpublic Object getValue(int row, String colName)
row - Row indexcolName - Column namepublic void setValue(Object row, Column col, Object v)
row - Rowcol - Columnv - Valuepublic void setValue(int row,
int col,
Object v)
row - Row indexcol - Column indexv - Valuepublic void setValue(int row,
String colName,
Object v)
row - Row indexcolName - Column namev - Valuepublic void setValue(int row,
Column column,
Object v)
row - Row indexcolumn - Columnv - Valuepublic ucar.ma2.Array getColumnData(int col)
throws ucar.ma2.InvalidRangeException
col - Column indexucar.ma2.InvalidRangeExceptionpublic ucar.ma2.Array getColumnData(String colName) throws ucar.ma2.InvalidRangeException
colName - Column nameucar.ma2.InvalidRangeExceptionpublic void addColumn(Column column)
column - Columnpublic void addColumn(Column column, ucar.ma2.Array a) throws ucar.ma2.InvalidRangeException
column - Columna - Column data arrayucar.ma2.InvalidRangeExceptionpublic void addColumn(Column column, Series s) throws ucar.ma2.InvalidRangeException
column - Columns - Column data seriesucar.ma2.InvalidRangeExceptionpublic void addColumn(int loc,
Column column,
ucar.ma2.Array a)
throws ucar.ma2.InvalidRangeException
loc - Locationcolumn - Columna - Column data arrayucar.ma2.InvalidRangeExceptionpublic void addColumn(String colName, ucar.ma2.Array a) throws ucar.ma2.InvalidRangeException
colName - Column namea - Column data arrayucar.ma2.InvalidRangeExceptionpublic void addColumn(int loc,
String colName,
ucar.ma2.Array a)
throws ucar.ma2.InvalidRangeException
loc - LocationcolName - Column namea - Column data arrayucar.ma2.InvalidRangeExceptionpublic void addColumn(int loc,
String colName,
Object o)
throws ucar.ma2.InvalidRangeException
loc - LocationcolName - Column nameo - Column data objectucar.ma2.InvalidRangeExceptionpublic void setColumn(String colName, ucar.ma2.Array a) throws ucar.ma2.InvalidRangeException
colName - Column namea - Column data arrayucar.ma2.InvalidRangeExceptionpublic void setColumn(String colName, Object a) throws ucar.ma2.InvalidRangeException
colName - Column namea - A valueucar.ma2.InvalidRangeExceptionpublic DataFrame append(DataFrame df)
df - Another data framepublic void dataToList()
public void dataReshape(int nrow,
int ncol)
throws ucar.ma2.InvalidRangeException
nrow - Number of rowsncol - Number of columnsucar.ma2.InvalidRangeExceptionpublic void append(Object name, List row)
name - Index elementrow - Row data listpublic DataFrame drop(List<String> colNames)
colNames - Column namespublic DataFrame drop(Column... cols)
cols - the names of columns to be removedpublic DataFrame drop(Integer... cols)
cols - the indices of the columns to be removedpublic DataFrame retain(Object... cols)
> DataFrame<Object> df = new DataFrame<>("name", "value", "category");
> df.retain("name", "category").columns();
[name, category] cols - the columns to include in the new data framepublic DataFrame retain(Integer... cols)
DataFrame<Object> df = new DataFrame<>("name", "value", "category");
df.retain(0, 2).columns();
[name, category] cols - the columns to include in the new data framepublic DataFrame numeric()
> DataFrame<Object> df = new DataFrame<>("name", "value");
> df.append(Arrays.asList("one", 1));
> df.append(Arrays.asList("two", 2));
> df.numeric().columns();
[value] public Object select(int row, ucar.ma2.Range colRange) throws ucar.ma2.InvalidRangeException
row - Row indexcolRange - Column rangeucar.ma2.InvalidRangeExceptionpublic void setValues(int row,
ucar.ma2.Range colRange,
Number value)
throws ucar.ma2.InvalidRangeException
row - Row indexcolRange - Column rangevalue - The valueucar.ma2.InvalidRangeExceptionpublic void setValues(int row,
ucar.ma2.Range colRange,
ucar.ma2.Array value)
throws ucar.ma2.InvalidRangeException
row - Row indexcolRange - Column rangevalue - The value arrayucar.ma2.InvalidRangeExceptionpublic Object select(ucar.ma2.Range rowRange, ucar.ma2.Range colRange) throws ucar.ma2.InvalidRangeException
rowRange - Row rangecolRange - Column rangeucar.ma2.InvalidRangeExceptionpublic Object select(ucar.ma2.Range rowRange, List<Integer> colRange) throws ucar.ma2.InvalidRangeException
rowRange - Row rangecolRange - Column rangeucar.ma2.InvalidRangeExceptionpublic Object select(List<Integer> rowRange, ucar.ma2.Range colRange) throws ucar.ma2.InvalidRangeException
rowRange - Row rangecolRange - Column rangeucar.ma2.InvalidRangeExceptionpublic Object select(List rowKeys, List<Integer> rowRange, ucar.ma2.Range colRange) throws ucar.ma2.InvalidRangeException
rowKeys - Row keysrowRange - Row rangecolRange - Column rangeucar.ma2.InvalidRangeExceptionpublic Object select(List rowKeys, List<Integer> rowRange, List<Integer> colRange) throws ucar.ma2.InvalidRangeException
rowKeys - Row keysrowRange - Row rangecolRange - Column rangeucar.ma2.InvalidRangeExceptionpublic Object select(int row, List<Integer> colRange)
row - Row indexcolRange - Column rangepublic Object select(List<Integer> rowRange, List<Integer> colRange)
rowRange - Row rangecolRange - Column rangepublic DataFrame transpose()
public String head(int n)
n - Head row numberpublic String tail(int n)
n - Tail row numberpublic static DataFrame readTable(String fileName, String delimiter, int skipRows, String formatSpec, String encoding, int indexCol, String indexFormat, List<String> names, Integer header, int skipFooter) throws FileNotFoundException, IOException, Exception
fileName - File namedelimiter - DelimiterskipRows - Number of lines to skip at begining of the fileformatSpec - Format specifiers stringencoding - Fle encodingindexCol - Column to be used as indexindexFormat - Index formatnames - Column namesheader - Row number to use as the column namesskipFooter - Number of lines at bottom of file to skipFileNotFoundExceptionIOExceptionExceptionpublic static DataFrame readTable(String fileName, String delimiter, int skipRows, String formatSpec, String encoding, int indexCol, String indexFormat, List<String> names, Integer header, int skipFooter, List<Object> usecolsin) throws FileNotFoundException, IOException, Exception
fileName - File namedelimiter - DelimiterskipRows - Number of lines to skip at begining of the fileformatSpec - Format specifiers stringencoding - Fle encodingindexCol - Column to be used as indexindexFormat - Index formatnames - Column namesheader - Row number to use as the column namesskipFooter - Number of lines at bottom of file to skipusecolsin - Filter columns by column names or indicesFileNotFoundExceptionIOExceptionExceptionpublic void saveCSV(String fileName, String delimiter, String dateFormat, String floatFormat, boolean index) throws IOException
fileName - File namedelimiter - DelimiterdateFormat - Date format stringfloatFormat - Float format stringindex - If write indexIOExceptionpublic <V> DataFrame describe()
public DataFrame sortByIndex(boolean ascending)
public <V> DataFrame sortBy(Comparator<List<V>> comparator)
public DataFrameGroupBy groupBy(KeyFunction function)
function - the function to reduce rows to grouping keyspublic DataFrameGroupBy groupBy(Integer... columns)
columns - The columnspublic DataFrameGroupBy groupBy(Object... columns)
columns - The columnspublic DataFrameGroupBy groupBy(List<Object> columns)
columns - The columnspublic DataFrameGroupBy groupByIndex(WindowFunction function)
function - the function to reduce rows to grouping keyspublic DataFrameGroupBy groupByIndex(String pStr)
pStr - Period stringpublic <V> DataFrame apply(Function<?,?> function)
V - function - The functionpublic DataFrame count()
public DataFrame sum()
public DataFrame mean()
public DataFrame min()
public DataFrame max()
public DataFrame median()
Copyright © 2019. All rights reserved.