Skip to content

Getting Started

milisp edited this page Oct 23, 2024 · 1 revision

Getting Started with Panars

This guide will help you get up and running with Panars quickly.

Importing Panars

After installation, you can import Panars in your Python script:

import panars as pa

Creating a DataFrame

You can create a DataFrame using a dictionary, similar to Pandas:

df = pa.DataFrame({
    "A": [1, 2, 3, 4],
    "B": [5, 6, 7, 8],
    "C": ["a", "b", "a", "b"]
})

Basic Operations

Here are some basic operations you can perform with Panars:

Viewing Data

# Display the first few rows
print(df.head())

# Display basic information about the DataFrame
print(df.info())

# Get summary statistics
print(df.describe())

Filtering Data

# Filter rows where column A is greater than 2
filtered_df = df[df["A"] > 2]

Grouping and Aggregating

# Group by column C and calculate mean of A and sum of B
result = df.groupby("C").agg({"A": "mean", "B": "sum"})

Sorting

# Sort the DataFrame by column B in descending order
sorted_df = df.sort_values("B", ascending=False)

Next Steps

  • Explore the API Reference for detailed information on available methods and functions.
  • Check out the Examples page for more complex usage scenarios.
  • If you're migrating from Pandas, see our Migration Guide for tips on transitioning your code.

Clone this wiki locally