Skip to content

Commit

Permalink
Add dataframes page
Browse files Browse the repository at this point in the history
  • Loading branch information
Merlin04 committed Jun 22, 2021
1 parent fcb553d commit b1bd8cb
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 2 deletions.
41 changes: 39 additions & 2 deletions pages/blocks/dataframes.mdx
Original file line number Diff line number Diff line change
@@ -1,17 +1,54 @@
import Callout from 'nextra-theme-docs/callout';

# DataFrames

A *DataFrame* is essentially a container for a dataset. It keeps track of all of the different columns and lets you do actions on them like swapping rows and columns.

## Matrix
![Screenshot of blocks in DataFrames category](/dataframes-blocks.png)

## Uploaded datasets

At the top of the DataFrames category is a section for uploaded datasets. This holds all of the blocks you can use to access your uploaded datasets. To learn more about uploading datasets, see our page on [dataset uploads](/feature-overview/dataset-uploads).

## Get column from DataFrame as array

This block is used to get a column from a DataFrame as a list (also called an array). This lets you use the column in other blocks, like machine learning models or plots.

## Empty DataFrame

This block is used to create an empty DataFrame. Right now this is not very useful, we may add a use for it in the future.

## DataFrame with headers and data

This block is used to create a DataFrame with predefined data. You can specify headers as a list of strings, where each string is one column name, and the data is a 2D array (a matrix).

<Callout emoji="💡">
A matrix block has a size limit of 10 by 10. If your dataset is larger than this, you should probably use the [dataset uploads](/feature-overview/dataset-uploads) feature.
</Callout>

## `file.csv` as DataFrame

This is the block used in the "Uploaded datasets" section, and can be used if you want to include a block accessing a dataset that you haven't uploaded yet (you'll still need to upload it before running the program, though).

## Transpose DataFrame

Transposing a DataFrame swaps the columns and rows of a dataset, so this:

| Column 1 | Column 2 | Column 3 ||
|----------|:----------|:----------:|:|
| 1 | 2 | 3 | 4 |
| 5 | 6 | 8 | 3 |
| 9 | 5 | 0 | 2 |

Becomes this:

| Column 1 | Column 2 | Column 3 |
|----------|:----------|:----------:|
| 1 | 5 | 9 |
| 2 | 6 | 5 |
| 3 | 8 | 0 |
| 4 | 3 | 2 |

## Select columns from DataFrame

## Get column from DataFrame as array
This returns a 2D array (a matrix) with the columns specified. Each list in the matrix represents a column; if you want the result to be a list of rows, then transpose the DataFrame first.
Binary file added public/dataframes-blocks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

1 comment on commit b1bd8cb

@vercel
Copy link

@vercel vercel bot commented on b1bd8cb Jun 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.