Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 19 additions & 25 deletions docs/userguide/importing_data.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

# Importing & exporting data

## Table of contents

[TOC]

## Supported Formats

Tablesaw supports importing and exporting data to and from a variety of data types and sources.
Expand All @@ -19,9 +15,10 @@ Tablesaw supports importing and exporting data to and from a variety of data typ
| Excel | Yes | |
| HTML | Yes | Yes |

## Importing data

**Note**: To minimize the size of the core library, some of the readers (currently JSON, HTML tables, and Excel files) are packaged in separate modules. You will need to include them in your project to use the `Table.read()` methods.
Importing/Exporting data from CSV and RDBMS are included in the standard tablesaw library. To import/export JSON and HTML data, and import Excel data, requires the [tablesaw-json](https://mvnrepository.com/artifact/tech.tablesaw/tablesaw-json), [tablesaw-html](https://mvnrepository.com/artifact/tech.tablesaw/tablesaw-html), and [tablesaw-excel](https://mvnrepository.com/artifact/tech.tablesaw/tablesaw-excel) dependencies, respectively.

## Importing data

See the Javadoc for [DataFrameReader](http://static.javadoc.io/tech.tablesaw/tablesaw-core/0.31.0/tech/tablesaw/io/DataFrameReader.html) for a listing of all the `Table.read()` methods that are available.

Expand Down Expand Up @@ -212,31 +209,28 @@ try (Statement stmt = conn.createStatement()) {

### Importing from HTML, JSON, Excel

Tablesaw supports importing data from HTML, JSON, and Excel. See the Javadoc for the [Table.read()](http://static.javadoc.io/tech.tablesaw/tablesaw-core/0.31.0/tech/tablesaw/io/DataFrameReader.html) methods for more info. You will need to add the corresponding optional dependency:
Tablesaw supports importing data from HTML, JSON, and Excel. See the Javadoc for the [Table.read()](http://static.javadoc.io/tech.tablesaw/tablesaw-core/0.31.0/tech/tablesaw/io/DataFrameReader.html) methods for more info.

```
<dependency>
<groupId>tech.tablesaw</groupId>
<artifactId>tablesaw-html</artifactId>
</dependency>
```
## Exporting data

```
<dependency>
<groupId>tech.tablesaw</groupId>
<artifactId>tablesaw-json</artifactId>
</dependency>
```
Tablesaw supports exporting data to CSV, HTML, and JSON. See the Javadoc for full details.

### Exporting to CSV

Any `Table` object can be exported to a local csv file using the following command.
```
<dependency>
<groupId>tech.tablesaw</groupId>
<artifactId>tablesaw-excel</artifactId>
</dependency>
Table myData; //name of table object

myData.write().csv("file-path-here.csv");
```

## Exporting data
### Exporting to JSON

```
Table myData; //name of table object

JsonWriter jsonWriter = new JsonWriter();
jsonWriter.write(myData, new Destination(new File("myData.json")));
```


TODO
4 changes: 4 additions & 0 deletions docs/userguide/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,9 @@ A dataframe is an in-memory, tabular data structure in which each column holds a

* Plotting data

### Support for Machine Learning Algorithms

* Integration with Smile machine learning library

### Looking ahead
In the rest of this User Guide we discuss each category of dataframe operation, as well as the visualization capabilities Tablesaw offers. If you haven't already tried it, we strongly recommend the [Getting Started with Tablesaw](https://jtablesaw.github.io/tablesaw/gettingstarted) as the best way to see how it all fits together.
11 changes: 0 additions & 11 deletions docs/userguide/reducing.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,3 @@ t.summarize(sentence.length(), min, q1, q2, q3, max, range)
```

In this example, a standard map function (*length()*) creates a NumberColumn containing the number of characters in each value of the StringColumn sentence. Various statistics (*min*, *q1*, etc.) are calculated on the resulting column.

## Conditional Summarization

Another useful facility is to summarize only that data that passes some test. For example, you could extract the common suffixes between two columns of String data, and then count the number that are longer than two characters. This can be done using the *summarizeIf()* method as follows:

```java
t.summarizeIf(c1.suffix(c2).length().isGreaterThan(2), count())
```

TODO: THIS NEEDS REVIEW. WHAT COLUMN GETS SUMMARIZED.

2 changes: 1 addition & 1 deletion docs/userguide/toc.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tablesaw User Guide
## Contents

* [Introduction](https://jtablesaw.github.io/tablesaw/userguide/introduction)
* [Importing Data](https://jtablesaw.github.io/tablesaw/userguide/importing_data)
* [Importing & Exporting Data](https://jtablesaw.github.io/tablesaw/userguide/importing_data)
* Transforming Data
* [Working with Columns](https://jtablesaw.github.io/tablesaw/userguide/columns)
* [Working with Tables](https://jtablesaw.github.io/tablesaw/userguide/tables)
Expand Down