A human-first natural language programming language for data science
Project description
NaturalDSL: Documentation
Overview
NaturalDSL is a human-first, natural programming language designed for data science. It abstracts away the complexity of traditional programming languages while providing powerful tools for data manipulation, visualization, and analysis. With seamless integration of Pandas, Numpy, Seaborn, Matplotlib, and Dask, NaturalDSL offers intuitive commands for handling common data analysis tasks.
Core Features
- Human-Readable Syntax: Use natural language constructs for common data science tasks.
- Data Manipulation: Load, clean, transform, and aggregate data.
- Data Visualization: Simple, intuitive plotting commands using Seaborn and Matplotlib.
- Parallel Computing: Handle large datasets with Dask.
- Extensibility: Easily extendable through plugins.
- AI Integration: Code autocompletion for frequent data science tasks.
Getting Started
System Requirements
- Python 3.7 or higher
- Pip for managing packages
Installation
To install NaturalDSL, use the following steps:
- Clone the repository (if you haven't done so yet):
git clone https://github.com/pradumana/naturaldsl.git
cd naturaldsl
- Install the required dependencies:
pip install -r requirements.txt
- (Optional) Install globally from PyPI:
pip install naturaldsl
CLI Usage
Basic Command Syntax
[COMMAND] [OPTIONS]
Here’s a summary of the most common commands for data analysis using NaturalDSL:
1. Loading Data
Load your data from CSV or Parquet files:
load data.csv
This command loads the data into NaturalDSL for further processing.
2. Data Cleaning
- Drop rows with missing values in a specific column:
drop_missing age
- Fill missing values in a specific column with a constant value:
fill_missing age 0
3. Data Transformation
- Rename a column:
rename old_name new_name
- Sort data by a column:
sort age descending
- Convert a column to a specific data type (e.g., datetime):
convert date_column datetime
4. Grouping and Aggregation
Group data by a specific column and apply an aggregation (e.g., sum, average):
group_by age sum
5. Data Visualization
- Generate a bar plot between two columns:
plot_bar age salary
- Generate a scatter plot between two columns:
plot_scatter age salary
6. Save Data
Save the processed data to a new file:
save cleaned_data.csv
Example CLI Session
Here’s an example session showing common data analysis steps:
load data.csv
drop_missing age
rename old_column new_column
sort age descending
group_by age mean
plot_scatter age salary
save cleaned_data.csv
This series of commands loads a dataset, cleans it, performs some transformations, generates a plot, and saves the cleaned data to a new file.
Advanced Features
Multiple Command Chaining
You can chain multiple commands in a single line to improve your workflow:
load data.csv && drop_missing age && plot_scatter age salary
Plot Customization
Customize the appearance of your plots, such as colors, labels, and titles, directly from the CLI. You could, for example, modify the color of a scatter plot:
plot_scatter age salary --color blue
Python API Usage
You can also use NaturalDSL in Python scripts for more control and flexibility.
Basic API Workflow
from natural_dsl_interpreter import NaturalDSLInterpreter
# Initialize the interpreter
interpreter = NaturalDSLInterpreter()
# Load data
interpreter.load("data.csv")
# Clean data
interpreter.drop_missing("age")
interpreter.fill_missing("age", 0)
# Transform data
interpreter.rename("old_column", "new_column")
interpreter.sort("age", ascending=False)
# Group and aggregate
interpreter.group_by("age", "sum")
# Visualize data
interpreter.plot_bar("age", "salary")
# Save data
interpreter.save("cleaned_data.csv")
Extending NaturalDSL
Creating Custom Functions
You can extend NaturalDSL by adding custom functions for specific use cases. Here’s an example:
- Define a custom function:
def custom_mean(dataframe, column):
return dataframe[column].mean()
- Register the custom function with the interpreter:
interpreter.register_function("custom_mean", custom_mean)
Using Plugins
You can extend NaturalDSL by creating plugins for additional features like new plotting methods, data sources, or algorithms. Once a plugin is created, you can load it using the CLI or Python API.
Contributing
We encourage contributions from the community! To contribute:
- Fork the repository on GitHub.
- Clone your fork and create a new branch:
git checkout -b feature-branch
- Make your changes, commit, and push them:
git commit -m "Added new feature"
git push origin feature-branch
- Open a pull request to merge your changes into the main repository.
License
NaturalDSL is licensed under the MIT License. See the LICENSE file for more details.
Contact
For more information or questions, please contact me at:
Email: prdmn.shrm@gmail.com
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file naturaldsl-0.3.0.tar.gz.
File metadata
- Download URL: naturaldsl-0.3.0.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9aa1c1bada52aca5c79d7b733077731e19eafffcd62a47fecd31aa3a20caadb2
|
|
| MD5 |
4250f6b3131af00e3d8736407e5b0512
|
|
| BLAKE2b-256 |
8743ae0ac14dcdb6a9a22cdb9f765542412caa4494fb524c130b250e6f49667b
|
File details
Details for the file naturaldsl-0.3.0-py3-none-any.whl.
File metadata
- Download URL: naturaldsl-0.3.0-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0bf8403645828813b3febdb2f59706776a3e19cab9cca19f60a423e962cd1b4b
|
|
| MD5 |
2b42966d5ce138cd315ce478d158319f
|
|
| BLAKE2b-256 |
2f264a624e1190f2ef6b3cf0ed002bf624023693312f96b810b8a9f0a596daaa
|