Thanks to visit codestin.com
Credit goes to github.com

Skip to content

csim/koalas

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Koalas 🐨

Build NuGet Version NuGet Downloads

Notebook ready C# data science tools and utilities inspired by Python pandas module.

Koalas is a .NET Standard 2.0 library that provides powerful extensions and utilities for C# development, particularly useful in Jupyter notebooks and data science scenarios. It includes string manipulation, file system helpers, text formatting builders, and more.

πŸš€ Features

πŸ“ Text Building & Formatting

  • TextTableBuilder - Create formatted tables with dynamic columns and styling
  • TextListBuilder - Build formatted lists with customizable separators and indentation
  • TextSectionBuilder - Create structured text sections with headers and content
  • TextFieldSetBuilder - Format key-value pairs and field sets

πŸ”§ Extension Methods

  • String Extensions - Rich string manipulation (Before, After, Compress, Indent, etc.)
  • DirectoryInfo Extensions - Enhanced directory operations and traversal
  • FileInfo Extensions - Simplified file operations and metadata access
  • LINQ Extensions - Additional LINQ operators for data processing
  • Object Extensions - JSON serialization and utility methods

πŸ“ File System Helpers

  • DirectoryInfoHelper - Directory enumeration and ancestor traversal
  • FileInfoHelper - File discovery and manipulation utilities

πŸ“¦ Installation

Install the package via NuGet Package Manager:

dotnet add package Koalas

Or via Package Manager Console:

Install-Package Koalas

πŸ› οΈ Usage Examples

String Extensions

using Koalas.Extensions;

string text = "Hello, World!";
string after = text.After("Hello, ");  // "World!"
string before = text.Before(" World");  // "Hello,"

string indented = "Line 1\nLine 2".Indent(4);
// "    Line 1\n    Line 2"

Text Table Building

using Koalas.Text;

var table = TextBuilder.Create()
    .StartTable()
    .AddColumn("Name", minWidth: 15)
    .AddColumn("Age", minWidth: 5)
    .AddColumn("City", minWidth: 10)
    .AddDataRow("John Doe", 30, "New York")
    .AddDataRow("Jane Smith", 25, "Los Angeles")
    .AddDataRow("Bob Johnson", 35, "Chicago")
    .EndTable()
    .Render();

Console.WriteLine(table);

Directory Operations

using Koalas;
using Koalas.Extensions;

var directory = new DirectoryInfo(@"C:\MyProject");

// Get all ancestor directories
var ancestors = directory.Ancestors();

// Get files with extension methods
var csharpFiles = directory.Files("*.cs");

File System Helpers

using static Koalas.DirectoryInfoHelper;
using static Koalas.FileInfoHelper;

// Static helper methods
var projectDir = Directory(@"C:\MyProject");
var sourceFiles = Files(projectDir, "*.cs");

JSON Serialization

using Koalas.Extensions;

var data = new { Name = "John", Age = 30 };
string json = data.ToJson();

// Pretty formatted JSON
string prettyJson = data.ToJson(writeIndented: true);

🎯 Target Framework

  • .NET Standard 2.0 - Compatible with .NET Framework 4.6.1+, .NET Core 2.0+, and .NET 5+
  • C# Language Version: Latest

πŸ”§ Development

Prerequisites

  • .NET 8.0 SDK
  • Visual Studio 2022 or VS Code

Building the Project

# Clone the repository
git clone https://github.com/csim/koalas.git
cd koalas

# Restore dependencies
dotnet restore

# Build the solution
dotnet build

# Run tests
dotnet test

Project Structure

src/
β”œβ”€β”€ Koalas/                    # Main library
β”‚   β”œβ”€β”€ Extensions/            # Extension methods
β”‚   β”œβ”€β”€ Text/                  # Text building utilities
β”‚   β”œβ”€β”€ DirectoryInfoHelper.cs # Directory operations
β”‚   └── FileInfoHelper.cs      # File operations
β”œβ”€β”€ Koalas.CommandLine/        # CLI application
└── Koalas.Tests/              # Unit tests

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • Inspired by the Python pandas library
  • Built for the .NET community

About

notebook ready C# data science tools inspired by python pandas

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages