Categorygithub.com/kevinmtanadi/godf
modulepackage
0.1.5
Repository: https://github.com/kevinmtanadi/godf.git
Documentation: pkg.go.dev

# README

godf

Go Reference

A simple dataframe handler for golang, inspired by pandas from python. I used @jedib0t's go-pretty to render the table.

It can handle simple data manipulation such as :

  • One hot encoding
  • Sorting
  • Shuffling data
  • Filtering

Install

go get -u github.com/kevinmtanadi/godf

Usage

Basic Usage

x := []float64{0.1, 0.2, 0.3, 0.4, 0.5}
y := []float64{1.1, 1.2, 1.3, 1.4, 1.5}
z := []float64{21, 22, 23, 24, 25}

df := godf.DataFrame(map[string]interface{}{
  "x": x,
  "y": y,
  "z": z,
})

df.Show()
┌───┬─────┬─────┬────┐
│ # │   X │   Y │  Z │
├───┼─────┼─────┼────┤
│ 1 │ 0.1 │ 1.1 │ 21 │
│ 2 │ 0.2 │ 1.2 │ 22 │
│ 3 │ 0.3 │ 1.3 │ 23 │
│ 4 │ 0.4 │ 1.4 │ 24 │
│ 5 │ 0.5 │ 1.5 │ 25 │
└───┴─────┴─────┴────┘

Read CSV File

df := godf.ReadCSV("data.csv")

df.Show()

License

MIT

# Functions

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
DataFrame initializes and returns a dataframe This function takes a map[string]interface{} as a variable where the string will be the header name and the interface{} will be the contained data Returns a pointer to the dataframe.
No description provided by the author
No description provided by the author
Read CSV and parse it into a dataframe Support reading from local file or URL.
No description provided by the author

# Structs

No description provided by the author

# Interfaces

No description provided by the author
No description provided by the author

# Type aliases

Eq filter rows where a data in the given column is equal to given value Example of usage: df.Where(Eq{"x": 5}) will only get data with x = 5.
GT filter rows where a data in the given column is greater than the given value Example of usage: df.Where(GT{"x": 5}) will only get data with x > 5.
GTE filter rows where a data in the given column is greater than or equal to the given value Example of usage: df.Where(GTE{"x": 5}) will only get data with x >= 5.
In filter all data which value is in the given slice Example of usage: df.Where(In{"x": []int{1, 2, 3, 4}}) will only get data with x = [1, 2, 3, 4].
LT filter rows where a data in the given column is less than the given value Example of usage: df.Where(LT{"x": 5}) will only get data with x < 5.
LTE filter rows where a data in the given column is less than or equal to the given value Example of usage: df.Where(LTE{"x": 5}) will only get data with x <= 5.
NotEq filter rows where a data in the given column is not equal to given value Example of usage: df.Where(NotEq{"x": 5}) will get all data except the data with x = 5.