GPandas

Documentation

Learn how to use GPandas for data manipulation in Go

Welcome to the GPandas documentation. GPandas is a high-performance data manipulation and analysis library written in Go, inspired by Python's popular pandas library.

Architecture Overview

GPandas uses a columnar architecture for efficient data operations:

Quick Start

Install GPandas using go get:

go get github.com/apoplexi24/gpandas

Minimal Example

package main

import (
    "fmt"
    "github.com/apoplexi24/gpandas"
)

func main() {
    gp := gpandas.GoPandas{}
    
    // Load data from CSV
    df, err := gp.Read_csv("data.csv")
    if err != nil {
        panic(err)
    }
    
    // Display the DataFrame
    fmt.Println(df.String())
}

Requirements

RequirementVersion
Go1.18 or above
ArchitectureAny (amd64, arm64)

GPandas requires Go version 1.18 or above due to its use of generics.

Core Features

Data Loading

FeatureFunctionDescription
CSV FilesRead_csv()Load CSV files with concurrent parsing
JSONRead_json(), ToJSON()Read and write records-oriented JSON
ExcelRead_excel(), ToExcel()Read and write .xlsx spreadsheets
ParquetRead_parquet(), ToParquet()Read and write Parquet files
SQL DatabasesRead_sql()Query SQL Server, PostgreSQL, and more
Google BigQueryFrom_gbq()Query BigQuery tables directly
In-MemoryDataFrame()Create DataFrames from Go data structures

DataFrame Operations

FeatureMethodsDescription
Column SelectionSelect(), SelectCol()Extract specific columns
RenamingRename()Rename columns while preserving order
Adding ColumnsAssign(), AssignFunc(), Insert()Add, compute, or insert columns
FilteringFilter(), Where()Subset rows by comparison or predicate
Membership & RangeIsin(), Between()Subset rows by a set of values or a value range
Top NNlargest(), Nsmallest()Take the n largest or smallest rows without a full sort
TransformationApply(), Map(), ApplyRow()Transform values and derive columns
ArithmeticAdd(), Sub(), Mul(), Div(), AddScalar()Element-wise arithmetic on columns and scalars
ComparisonGt(), Lt(), Eq(), GtScalar()Element-wise comparisons producing boolean columns
String MethodsStr().Lower(), Contains(), Len()Vectorized string operations
Missing DataFillNA(), DropNA(), IsNA()Detect, fill, and drop null values
DeduplicationUnique(), Duplicated(), DropDuplicates()Find distinct values and remove duplicates
Type CastingAsType(), DTypes(), Info()Convert column types and inspect structure
StatisticsDescribe(), Mean(), ValueCounts()Summarize and aggregate numeric data
CorrelationCorr(), Cov()Pairwise correlation and covariance
SamplingSample(), Pipe()Random sampling and method chaining
GroupingGroupBy(), Agg()Group rows and aggregate
WindowRolling(), Shift(), CumSum()Moving and cumulative operations
ReshapingStack(), Unstack(), PivotTable(), Melt()Convert between wide and long
DateTimeToDatetime(), Dt()Parse dates and extract components
CategoricalAsCategorical(), Categories()Memory-efficient repeated strings
MergingMerge(), MergeOn()Join DataFrames on one or more keys
DisplayString()Pretty-print DataFrame as table
ExportToCSV()Export to CSV file or string
PlottingPlotBar(), PlotScatter(), PlotHistogram(), PlotHeatmap()Generate interactive charts

Indexing

TypeAccessorDescription
Label-basedLoc()Access by row labels and column names
Position-basedILoc()Access by integer positions
Index ManagementSetIndex(), ResetIndex()Custom row labels

Documentation Guide

Explore the documentation to learn more about GPandas capabilities:

Getting Started

Loading Data

Working with DataFrames

Indexing & Selection

Core Types

  • Series - The fundamental column type

Performance Highlights

GPandas is designed for speed:

  • Columnar Storage: Efficient memory layout for analytical queries
  • Concurrent CSV Parsing: Multi-core utilization for large files
  • Zero-Copy Operations: Minimal data copying where possible
  • Thread-Safe Series: RWMutex protection for concurrent access

On this page