@mseep/csv-editor 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/ISSUE_TEMPLATE/bug_report.md +53 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +38 -0
- package/.github/workflows/deploy-docs.yml +62 -0
- package/.github/workflows/publish-github.yml +52 -0
- package/.github/workflows/publish.yml +44 -0
- package/.github/workflows/test.yml +32 -0
- package/.pre-commit-config.yaml +157 -0
- package/ALTERNATIVE_PUBLISHING.md +175 -0
- package/ARCHITECTURE.md +1011 -0
- package/CHANGELOG.md +99 -0
- package/CODE_OF_CONDUCT.md +41 -0
- package/CONTRIBUTING.md +427 -0
- package/Dockerfile +22 -0
- package/LICENSE +21 -0
- package/MCP_CONFIG.md +505 -0
- package/PUBLISHING.md +210 -0
- package/README.md +400 -0
- package/SECURITY.md +61 -0
- package/docs/README.md +41 -0
- package/docs/blog/2019-05-28-first-blog-post.md +12 -0
- package/docs/blog/2019-05-29-long-blog-post.md +44 -0
- package/docs/blog/2021-08-01-mdx-blog-post.mdx +24 -0
- package/docs/blog/2021-08-26-welcome/docusaurus-plushie-banner.jpeg +0 -0
- package/docs/blog/2021-08-26-welcome/index.md +29 -0
- package/docs/blog/authors.yml +25 -0
- package/docs/blog/tags.yml +19 -0
- package/docs/docs/api/overview.md +183 -0
- package/docs/docs/installation.md +252 -0
- package/docs/docs/intro.md +87 -0
- package/docs/docs/tutorial-basics/_category_.json +8 -0
- package/docs/docs/tutorial-basics/congratulations.md +23 -0
- package/docs/docs/tutorial-basics/create-a-blog-post.md +34 -0
- package/docs/docs/tutorial-basics/create-a-document.md +57 -0
- package/docs/docs/tutorial-basics/create-a-page.md +43 -0
- package/docs/docs/tutorial-basics/deploy-your-site.md +31 -0
- package/docs/docs/tutorial-basics/markdown-features.mdx +152 -0
- package/docs/docs/tutorial-extras/_category_.json +7 -0
- package/docs/docs/tutorial-extras/img/docsVersionDropdown.png +0 -0
- package/docs/docs/tutorial-extras/img/localeDropdown.png +0 -0
- package/docs/docs/tutorial-extras/manage-docs-versions.md +55 -0
- package/docs/docs/tutorial-extras/translate-your-site.md +88 -0
- package/docs/docs/tutorials/quickstart.md +365 -0
- package/docs/docusaurus.config.ts +163 -0
- package/docs/package-lock.json +17493 -0
- package/docs/package.json +48 -0
- package/docs/sidebars.ts +33 -0
- package/docs/src/components/HomepageFeatures/index.tsx +71 -0
- package/docs/src/components/HomepageFeatures/styles.module.css +11 -0
- package/docs/src/css/custom.css +30 -0
- package/docs/src/pages/index.module.css +23 -0
- package/docs/src/pages/index.tsx +44 -0
- package/docs/src/pages/markdown-page.md +7 -0
- package/docs/static/.nojekyll +0 -0
- package/docs/static/img/docusaurus-social-card.jpg +0 -0
- package/docs/static/img/docusaurus.png +0 -0
- package/docs/static/img/favicon.ico +0 -0
- package/docs/static/img/logo.svg +1 -0
- package/docs/static/img/undraw_docusaurus_mountain.svg +171 -0
- package/docs/static/img/undraw_docusaurus_react.svg +170 -0
- package/docs/static/img/undraw_docusaurus_tree.svg +40 -0
- package/docs/tsconfig.json +8 -0
- package/examples/README.md +48 -0
- package/examples/auto_save_demo.py +206 -0
- package/examples/auto_save_overwrite.py +201 -0
- package/examples/basic_usage.py +135 -0
- package/examples/demo.py +139 -0
- package/examples/history_demo.py +317 -0
- package/examples/test_default_autosave.py +124 -0
- package/examples/update_consignee_example.py +179 -0
- package/package.json +51 -0
- package/plans/2026-04-19-fastmcp3-migration-plan.md +1045 -0
- package/pyproject.toml +331 -0
- package/requirements-dev.txt +30 -0
- package/requirements.txt +22 -0
- package/scripts/publish.py +67 -0
- package/smithery.yaml +15 -0
- package/specs/2026-04-19-fastmcp3-migration-design.md +243 -0
- package/src/csv_editor/__init__.py +8 -0
- package/src/csv_editor/models/__init__.py +39 -0
- package/src/csv_editor/models/auto_save.py +246 -0
- package/src/csv_editor/models/csv_session.py +468 -0
- package/src/csv_editor/models/data_models.py +244 -0
- package/src/csv_editor/models/history_manager.py +456 -0
- package/src/csv_editor/prompts/__init__.py +0 -0
- package/src/csv_editor/prompts/data_prompts.py +13 -0
- package/src/csv_editor/resources/__init__.py +0 -0
- package/src/csv_editor/resources/csv_resources.py +22 -0
- package/src/csv_editor/server.py +640 -0
- package/src/csv_editor/tools/__init__.py +5 -0
- package/src/csv_editor/tools/analytics.py +700 -0
- package/src/csv_editor/tools/auto_save_operations.py +235 -0
- package/src/csv_editor/tools/data_operations.py +3 -0
- package/src/csv_editor/tools/history_operations.py +315 -0
- package/src/csv_editor/tools/io_operations.py +431 -0
- package/src/csv_editor/tools/transformations.py +663 -0
- package/src/csv_editor/tools/validation.py +822 -0
- package/src/csv_editor/utils/__init__.py +0 -0
- package/src/csv_editor/utils/validators.py +205 -0
- package/tests/README.md +65 -0
- package/tests/__init__.py +7 -0
- package/tests/conftest.py +50 -0
- package/tests/test_auto_save.py +378 -0
- package/tests/test_basic.py +103 -0
- package/tests/test_integration.py +356 -0
- package/tests/test_server_boot.py +50 -0
- package/tests/test_settings.py +184 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
sidebar_position: 5
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Deploy your site
|
|
6
|
+
|
|
7
|
+
Docusaurus is a **static-site-generator** (also called **[Jamstack](https://jamstack.org/)**).
|
|
8
|
+
|
|
9
|
+
It builds your site as simple **static HTML, JavaScript and CSS files**.
|
|
10
|
+
|
|
11
|
+
## Build your site
|
|
12
|
+
|
|
13
|
+
Build your site **for production**:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm run build
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
The static files are generated in the `build` folder.
|
|
20
|
+
|
|
21
|
+
## Deploy your site
|
|
22
|
+
|
|
23
|
+
Test your production build locally:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm run serve
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The `build` folder is now served at [http://localhost:3000/](http://localhost:3000/).
|
|
30
|
+
|
|
31
|
+
You can now deploy the `build` folder **almost anywhere** easily, **for free** or very small cost (read the **[Deployment Guide](https://docusaurus.io/docs/deployment)**).
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
---
|
|
2
|
+
sidebar_position: 4
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Markdown Features
|
|
6
|
+
|
|
7
|
+
Docusaurus supports **[Markdown](https://daringfireball.net/projects/markdown/syntax)** and a few **additional features**.
|
|
8
|
+
|
|
9
|
+
## Front Matter
|
|
10
|
+
|
|
11
|
+
Markdown documents have metadata at the top called [Front Matter](https://jekyllrb.com/docs/front-matter/):
|
|
12
|
+
|
|
13
|
+
```text title="my-doc.md"
|
|
14
|
+
// highlight-start
|
|
15
|
+
---
|
|
16
|
+
id: my-doc-id
|
|
17
|
+
title: My document title
|
|
18
|
+
description: My document description
|
|
19
|
+
slug: /my-custom-url
|
|
20
|
+
---
|
|
21
|
+
// highlight-end
|
|
22
|
+
|
|
23
|
+
## Markdown heading
|
|
24
|
+
|
|
25
|
+
Markdown text with [links](./hello.md)
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Links
|
|
29
|
+
|
|
30
|
+
Regular Markdown links are supported, using url paths or relative file paths.
|
|
31
|
+
|
|
32
|
+
```md
|
|
33
|
+
Let's see how to [Create a page](/create-a-page).
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
```md
|
|
37
|
+
Let's see how to [Create a page](./create-a-page.md).
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**Result:** Let's see how to [Create a page](./create-a-page.md).
|
|
41
|
+
|
|
42
|
+
## Images
|
|
43
|
+
|
|
44
|
+
Regular Markdown images are supported.
|
|
45
|
+
|
|
46
|
+
You can use absolute paths to reference images in the static directory (`static/img/docusaurus.png`):
|
|
47
|
+
|
|
48
|
+
```md
|
|
49
|
+

|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+

|
|
53
|
+
|
|
54
|
+
You can reference images relative to the current file as well. This is particularly useful to colocate images close to the Markdown files using them:
|
|
55
|
+
|
|
56
|
+
```md
|
|
57
|
+

|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Code Blocks
|
|
61
|
+
|
|
62
|
+
Markdown code blocks are supported with Syntax highlighting.
|
|
63
|
+
|
|
64
|
+
````md
|
|
65
|
+
```jsx title="src/components/HelloDocusaurus.js"
|
|
66
|
+
function HelloDocusaurus() {
|
|
67
|
+
return <h1>Hello, Docusaurus!</h1>;
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
````
|
|
71
|
+
|
|
72
|
+
```jsx title="src/components/HelloDocusaurus.js"
|
|
73
|
+
function HelloDocusaurus() {
|
|
74
|
+
return <h1>Hello, Docusaurus!</h1>;
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Admonitions
|
|
79
|
+
|
|
80
|
+
Docusaurus has a special syntax to create admonitions and callouts:
|
|
81
|
+
|
|
82
|
+
```md
|
|
83
|
+
:::tip My tip
|
|
84
|
+
|
|
85
|
+
Use this awesome feature option
|
|
86
|
+
|
|
87
|
+
:::
|
|
88
|
+
|
|
89
|
+
:::danger Take care
|
|
90
|
+
|
|
91
|
+
This action is dangerous
|
|
92
|
+
|
|
93
|
+
:::
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
:::tip My tip
|
|
97
|
+
|
|
98
|
+
Use this awesome feature option
|
|
99
|
+
|
|
100
|
+
:::
|
|
101
|
+
|
|
102
|
+
:::danger Take care
|
|
103
|
+
|
|
104
|
+
This action is dangerous
|
|
105
|
+
|
|
106
|
+
:::
|
|
107
|
+
|
|
108
|
+
## MDX and React Components
|
|
109
|
+
|
|
110
|
+
[MDX](https://mdxjs.com/) can make your documentation more **interactive** and allows using any **React components inside Markdown**:
|
|
111
|
+
|
|
112
|
+
```jsx
|
|
113
|
+
export const Highlight = ({children, color}) => (
|
|
114
|
+
<span
|
|
115
|
+
style={{
|
|
116
|
+
backgroundColor: color,
|
|
117
|
+
borderRadius: '20px',
|
|
118
|
+
color: '#fff',
|
|
119
|
+
padding: '10px',
|
|
120
|
+
cursor: 'pointer',
|
|
121
|
+
}}
|
|
122
|
+
onClick={() => {
|
|
123
|
+
alert(`You clicked the color ${color} with label ${children}`)
|
|
124
|
+
}}>
|
|
125
|
+
{children}
|
|
126
|
+
</span>
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
This is <Highlight color="#25c2a0">Docusaurus green</Highlight> !
|
|
130
|
+
|
|
131
|
+
This is <Highlight color="#1877F2">Facebook blue</Highlight> !
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
export const Highlight = ({children, color}) => (
|
|
135
|
+
<span
|
|
136
|
+
style={{
|
|
137
|
+
backgroundColor: color,
|
|
138
|
+
borderRadius: '20px',
|
|
139
|
+
color: '#fff',
|
|
140
|
+
padding: '10px',
|
|
141
|
+
cursor: 'pointer',
|
|
142
|
+
}}
|
|
143
|
+
onClick={() => {
|
|
144
|
+
alert(`You clicked the color ${color} with label ${children}`);
|
|
145
|
+
}}>
|
|
146
|
+
{children}
|
|
147
|
+
</span>
|
|
148
|
+
);
|
|
149
|
+
|
|
150
|
+
This is <Highlight color="#25c2a0">Docusaurus green</Highlight> !
|
|
151
|
+
|
|
152
|
+
This is <Highlight color="#1877F2">Facebook blue</Highlight> !
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
sidebar_position: 1
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Manage Docs Versions
|
|
6
|
+
|
|
7
|
+
Docusaurus can manage multiple versions of your docs.
|
|
8
|
+
|
|
9
|
+
## Create a docs version
|
|
10
|
+
|
|
11
|
+
Release a version 1.0 of your project:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm run docusaurus docs:version 1.0
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
The `docs` folder is copied into `versioned_docs/version-1.0` and `versions.json` is created.
|
|
18
|
+
|
|
19
|
+
Your docs now have 2 versions:
|
|
20
|
+
|
|
21
|
+
- `1.0` at `http://localhost:3000/docs/` for the version 1.0 docs
|
|
22
|
+
- `current` at `http://localhost:3000/docs/next/` for the **upcoming, unreleased docs**
|
|
23
|
+
|
|
24
|
+
## Add a Version Dropdown
|
|
25
|
+
|
|
26
|
+
To navigate seamlessly across versions, add a version dropdown.
|
|
27
|
+
|
|
28
|
+
Modify the `docusaurus.config.js` file:
|
|
29
|
+
|
|
30
|
+
```js title="docusaurus.config.js"
|
|
31
|
+
export default {
|
|
32
|
+
themeConfig: {
|
|
33
|
+
navbar: {
|
|
34
|
+
items: [
|
|
35
|
+
// highlight-start
|
|
36
|
+
{
|
|
37
|
+
type: 'docsVersionDropdown',
|
|
38
|
+
},
|
|
39
|
+
// highlight-end
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
The docs version dropdown appears in your navbar:
|
|
47
|
+
|
|
48
|
+

|
|
49
|
+
|
|
50
|
+
## Update an existing version
|
|
51
|
+
|
|
52
|
+
It is possible to edit versioned docs in their respective folder:
|
|
53
|
+
|
|
54
|
+
- `versioned_docs/version-1.0/hello.md` updates `http://localhost:3000/docs/hello`
|
|
55
|
+
- `docs/hello.md` updates `http://localhost:3000/docs/next/hello`
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
---
|
|
2
|
+
sidebar_position: 2
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Translate your site
|
|
6
|
+
|
|
7
|
+
Let's translate `docs/intro.md` to French.
|
|
8
|
+
|
|
9
|
+
## Configure i18n
|
|
10
|
+
|
|
11
|
+
Modify `docusaurus.config.js` to add support for the `fr` locale:
|
|
12
|
+
|
|
13
|
+
```js title="docusaurus.config.js"
|
|
14
|
+
export default {
|
|
15
|
+
i18n: {
|
|
16
|
+
defaultLocale: 'en',
|
|
17
|
+
locales: ['en', 'fr'],
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Translate a doc
|
|
23
|
+
|
|
24
|
+
Copy the `docs/intro.md` file to the `i18n/fr` folder:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
mkdir -p i18n/fr/docusaurus-plugin-content-docs/current/
|
|
28
|
+
|
|
29
|
+
cp docs/intro.md i18n/fr/docusaurus-plugin-content-docs/current/intro.md
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Translate `i18n/fr/docusaurus-plugin-content-docs/current/intro.md` in French.
|
|
33
|
+
|
|
34
|
+
## Start your localized site
|
|
35
|
+
|
|
36
|
+
Start your site on the French locale:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npm run start -- --locale fr
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Your localized site is accessible at [http://localhost:3000/fr/](http://localhost:3000/fr/) and the `Getting Started` page is translated.
|
|
43
|
+
|
|
44
|
+
:::caution
|
|
45
|
+
|
|
46
|
+
In development, you can only use one locale at a time.
|
|
47
|
+
|
|
48
|
+
:::
|
|
49
|
+
|
|
50
|
+
## Add a Locale Dropdown
|
|
51
|
+
|
|
52
|
+
To navigate seamlessly across languages, add a locale dropdown.
|
|
53
|
+
|
|
54
|
+
Modify the `docusaurus.config.js` file:
|
|
55
|
+
|
|
56
|
+
```js title="docusaurus.config.js"
|
|
57
|
+
export default {
|
|
58
|
+
themeConfig: {
|
|
59
|
+
navbar: {
|
|
60
|
+
items: [
|
|
61
|
+
// highlight-start
|
|
62
|
+
{
|
|
63
|
+
type: 'localeDropdown',
|
|
64
|
+
},
|
|
65
|
+
// highlight-end
|
|
66
|
+
],
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
The locale dropdown now appears in your navbar:
|
|
73
|
+
|
|
74
|
+

|
|
75
|
+
|
|
76
|
+
## Build your localized site
|
|
77
|
+
|
|
78
|
+
Build your site for a specific locale:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
npm run build -- --locale fr
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Or build your site to include all the locales at once:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
npm run build
|
|
88
|
+
```
|
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
---
|
|
2
|
+
sidebar_position: 1
|
|
3
|
+
title: Quick Start
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Quick Start Tutorial
|
|
7
|
+
|
|
8
|
+
Learn how to use CSV Editor in 10 minutes with this hands-on tutorial. We'll process a sample sales dataset step by step.
|
|
9
|
+
|
|
10
|
+
## Prerequisites
|
|
11
|
+
|
|
12
|
+
- CSV Editor installed and configured (see [Installation Guide](../installation))
|
|
13
|
+
- An AI assistant client (Claude Desktop, Continue, etc.) configured
|
|
14
|
+
|
|
15
|
+
## Sample Dataset
|
|
16
|
+
|
|
17
|
+
For this tutorial, we'll use a sample sales dataset. You can create it or use your own CSV file.
|
|
18
|
+
|
|
19
|
+
```csv
|
|
20
|
+
date,product,category,quantity,price,customer_id
|
|
21
|
+
2024-01-15,Laptop,Electronics,2,1299.99,C001
|
|
22
|
+
2024-01-16,Mouse,Electronics,5,29.99,C002
|
|
23
|
+
2024-01-16,Desk,Furniture,1,399.99,C001
|
|
24
|
+
2024-01-17,Chair,Furniture,3,199.99,C003
|
|
25
|
+
2024-01-18,Monitor,Electronics,2,599.99,C002
|
|
26
|
+
2024-01-18,Keyboard,Electronics,,89.99,C001
|
|
27
|
+
2024-01-19,Lamp,Furniture,4,49.99,
|
|
28
|
+
2024-01-20,Laptop,Electronics,1,1299.99,C004
|
|
29
|
+
2024-01-20,Mouse,Electronics,3,29.99,C003
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Step 1: Load the Data
|
|
33
|
+
|
|
34
|
+
First, let's load the CSV file into CSV Editor:
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
# Load the CSV file
|
|
38
|
+
result = load_csv(file_path="/path/to/sales_data.csv")
|
|
39
|
+
|
|
40
|
+
# The result contains:
|
|
41
|
+
# - session_id: Unique identifier for this session
|
|
42
|
+
# - row_count: Number of rows loaded
|
|
43
|
+
# - column_count: Number of columns
|
|
44
|
+
# - columns: List of column names
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**Expected Output:**
|
|
48
|
+
```json
|
|
49
|
+
{
|
|
50
|
+
"session_id": "abc123",
|
|
51
|
+
"row_count": 9,
|
|
52
|
+
"column_count": 6,
|
|
53
|
+
"columns": ["date", "product", "category", "quantity", "price", "customer_id"]
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Step 2: Explore the Data
|
|
58
|
+
|
|
59
|
+
Let's get basic statistics about our dataset:
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
# Get statistical summary
|
|
63
|
+
stats = get_statistics(session_id="abc123")
|
|
64
|
+
|
|
65
|
+
# Get value counts for categories
|
|
66
|
+
categories = get_value_counts(
|
|
67
|
+
session_id="abc123",
|
|
68
|
+
column="category"
|
|
69
|
+
)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Statistics Output:**
|
|
73
|
+
```json
|
|
74
|
+
{
|
|
75
|
+
"quantity": {
|
|
76
|
+
"count": 8,
|
|
77
|
+
"mean": 2.625,
|
|
78
|
+
"std": 1.302,
|
|
79
|
+
"min": 1,
|
|
80
|
+
"max": 5
|
|
81
|
+
},
|
|
82
|
+
"price": {
|
|
83
|
+
"count": 9,
|
|
84
|
+
"mean": 454.43,
|
|
85
|
+
"std": 498.12,
|
|
86
|
+
"min": 29.99,
|
|
87
|
+
"max": 1299.99
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Step 3: Clean the Data
|
|
93
|
+
|
|
94
|
+
Notice we have missing values? Let's fix them:
|
|
95
|
+
|
|
96
|
+
```python
|
|
97
|
+
# Fill missing quantity with median
|
|
98
|
+
fill_missing_values(
|
|
99
|
+
session_id="abc123",
|
|
100
|
+
strategy="median",
|
|
101
|
+
columns=["quantity"]
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
# Fill missing customer_id with "UNKNOWN"
|
|
105
|
+
fill_missing_values(
|
|
106
|
+
session_id="abc123",
|
|
107
|
+
strategy="fill",
|
|
108
|
+
columns=["customer_id"],
|
|
109
|
+
fill_value="UNKNOWN"
|
|
110
|
+
)
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Step 4: Transform the Data
|
|
114
|
+
|
|
115
|
+
Let's add a calculated column for total sales:
|
|
116
|
+
|
|
117
|
+
```python
|
|
118
|
+
# Add total_sales column (quantity * price)
|
|
119
|
+
add_column(
|
|
120
|
+
session_id="abc123",
|
|
121
|
+
name="total_sales",
|
|
122
|
+
formula="quantity * price"
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
# Convert date to datetime type
|
|
126
|
+
change_column_type(
|
|
127
|
+
session_id="abc123",
|
|
128
|
+
column="date",
|
|
129
|
+
dtype="datetime"
|
|
130
|
+
)
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Step 5: Filter and Sort
|
|
134
|
+
|
|
135
|
+
Let's find high-value transactions:
|
|
136
|
+
|
|
137
|
+
```python
|
|
138
|
+
# Filter for sales over $500
|
|
139
|
+
filter_rows(
|
|
140
|
+
session_id="abc123",
|
|
141
|
+
conditions=[
|
|
142
|
+
{"column": "total_sales", "operator": ">", "value": 500}
|
|
143
|
+
]
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
# Sort by total_sales descending
|
|
147
|
+
sort_data(
|
|
148
|
+
session_id="abc123",
|
|
149
|
+
columns=["total_sales"],
|
|
150
|
+
ascending=[False]
|
|
151
|
+
)
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Step 6: Analyze
|
|
155
|
+
|
|
156
|
+
Perform aggregation by category:
|
|
157
|
+
|
|
158
|
+
```python
|
|
159
|
+
# Group by category and calculate totals
|
|
160
|
+
analysis = group_by_aggregate(
|
|
161
|
+
session_id="abc123",
|
|
162
|
+
group_by=["category"],
|
|
163
|
+
aggregations={
|
|
164
|
+
"quantity": ["sum", "mean"],
|
|
165
|
+
"total_sales": ["sum", "mean"],
|
|
166
|
+
"product": "count"
|
|
167
|
+
}
|
|
168
|
+
)
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
**Aggregation Result:**
|
|
172
|
+
```json
|
|
173
|
+
{
|
|
174
|
+
"data": [
|
|
175
|
+
{
|
|
176
|
+
"category": "Electronics",
|
|
177
|
+
"quantity_sum": 13,
|
|
178
|
+
"quantity_mean": 2.6,
|
|
179
|
+
"total_sales_sum": 4919.92,
|
|
180
|
+
"total_sales_mean": 983.98,
|
|
181
|
+
"product_count": 5
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
"category": "Furniture",
|
|
185
|
+
"quantity_sum": 8,
|
|
186
|
+
"quantity_mean": 2.67,
|
|
187
|
+
"total_sales_sum": 1049.94,
|
|
188
|
+
"total_sales_mean": 349.98,
|
|
189
|
+
"product_count": 3
|
|
190
|
+
}
|
|
191
|
+
]
|
|
192
|
+
}
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## Step 7: Validate Quality
|
|
196
|
+
|
|
197
|
+
Check the data quality:
|
|
198
|
+
|
|
199
|
+
```python
|
|
200
|
+
# Check overall data quality
|
|
201
|
+
quality = check_data_quality(session_id="abc123")
|
|
202
|
+
|
|
203
|
+
# Validate against schema
|
|
204
|
+
schema = {
|
|
205
|
+
"date": {"type": "datetime", "required": True},
|
|
206
|
+
"product": {"type": "string", "required": True},
|
|
207
|
+
"category": {"type": "string", "required": True},
|
|
208
|
+
"quantity": {"type": "integer", "min": 0},
|
|
209
|
+
"price": {"type": "float", "min": 0},
|
|
210
|
+
"customer_id": {"type": "string", "required": True}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
validation = validate_schema(
|
|
214
|
+
session_id="abc123",
|
|
215
|
+
schema=schema
|
|
216
|
+
)
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
## Step 8: Export Results
|
|
220
|
+
|
|
221
|
+
Finally, export the cleaned and processed data:
|
|
222
|
+
|
|
223
|
+
```python
|
|
224
|
+
# Export as Excel with formatting
|
|
225
|
+
export_csv(
|
|
226
|
+
session_id="abc123",
|
|
227
|
+
file_path="/path/to/processed_sales.xlsx",
|
|
228
|
+
format="excel"
|
|
229
|
+
)
|
|
230
|
+
|
|
231
|
+
# Export summary as JSON
|
|
232
|
+
export_csv(
|
|
233
|
+
session_id="abc123",
|
|
234
|
+
file_path="/path/to/sales_summary.json",
|
|
235
|
+
format="json"
|
|
236
|
+
)
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
## Complete Workflow Example
|
|
240
|
+
|
|
241
|
+
Here's the entire workflow as a single script:
|
|
242
|
+
|
|
243
|
+
```python
|
|
244
|
+
# 1. Load data
|
|
245
|
+
session = load_csv("/path/to/sales_data.csv")
|
|
246
|
+
sid = session["session_id"]
|
|
247
|
+
|
|
248
|
+
# 2. Clean missing values
|
|
249
|
+
fill_missing_values(sid, strategy="median", columns=["quantity"])
|
|
250
|
+
fill_missing_values(sid, strategy="fill", columns=["customer_id"], fill_value="UNKNOWN")
|
|
251
|
+
|
|
252
|
+
# 3. Add calculated columns
|
|
253
|
+
add_column(sid, name="total_sales", formula="quantity * price")
|
|
254
|
+
change_column_type(sid, column="date", dtype="datetime")
|
|
255
|
+
|
|
256
|
+
# 4. Analyze by category
|
|
257
|
+
analysis = group_by_aggregate(
|
|
258
|
+
sid,
|
|
259
|
+
group_by=["category"],
|
|
260
|
+
aggregations={
|
|
261
|
+
"total_sales": ["sum", "mean"],
|
|
262
|
+
"quantity": "sum"
|
|
263
|
+
}
|
|
264
|
+
)
|
|
265
|
+
|
|
266
|
+
# 5. Find high-value transactions
|
|
267
|
+
filter_rows(sid, conditions=[
|
|
268
|
+
{"column": "total_sales", "operator": ">", "value": 500}
|
|
269
|
+
])
|
|
270
|
+
|
|
271
|
+
# 6. Export results
|
|
272
|
+
export_csv(sid, "/path/to/results.xlsx", format="excel")
|
|
273
|
+
|
|
274
|
+
# 7. Clean up
|
|
275
|
+
close_session(sid)
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
## Using Auto-Save
|
|
279
|
+
|
|
280
|
+
Enable auto-save to never lose your work:
|
|
281
|
+
|
|
282
|
+
```python
|
|
283
|
+
# Configure auto-save with backup strategy
|
|
284
|
+
configure_auto_save(
|
|
285
|
+
session_id="abc123",
|
|
286
|
+
enabled=True,
|
|
287
|
+
strategy="backup",
|
|
288
|
+
backup_dir="/path/to/backups",
|
|
289
|
+
max_backups=5
|
|
290
|
+
)
|
|
291
|
+
|
|
292
|
+
# Now all operations are automatically saved!
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
## Using History
|
|
296
|
+
|
|
297
|
+
Track and undo operations:
|
|
298
|
+
|
|
299
|
+
```python
|
|
300
|
+
# View operation history
|
|
301
|
+
history = get_history(session_id="abc123")
|
|
302
|
+
|
|
303
|
+
# Undo last operation
|
|
304
|
+
undo(session_id="abc123")
|
|
305
|
+
|
|
306
|
+
# Redo if needed
|
|
307
|
+
redo(session_id="abc123")
|
|
308
|
+
|
|
309
|
+
# Restore to specific point
|
|
310
|
+
restore_to_operation(
|
|
311
|
+
session_id="abc123",
|
|
312
|
+
operation_id="op_5"
|
|
313
|
+
)
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
## Tips for Success
|
|
317
|
+
|
|
318
|
+
1. **Start Simple**: Begin with basic operations before complex transformations
|
|
319
|
+
2. **Check Your Data**: Use `get_session_info()` frequently to understand your data state
|
|
320
|
+
3. **Save Often**: Enable auto-save for important data
|
|
321
|
+
4. **Validate Early**: Check data quality before extensive processing
|
|
322
|
+
5. **Use Appropriate Types**: Convert columns to correct types for better performance
|
|
323
|
+
|
|
324
|
+
## Common Use Cases
|
|
325
|
+
|
|
326
|
+
### Data Cleaning Pipeline
|
|
327
|
+
```python
|
|
328
|
+
# Remove duplicates → Fill missing → Fix types → Validate
|
|
329
|
+
remove_duplicates(sid)
|
|
330
|
+
fill_missing_values(sid, strategy="mean")
|
|
331
|
+
change_column_type(sid, column="date", dtype="datetime")
|
|
332
|
+
check_data_quality(sid)
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
### Quick Analysis
|
|
336
|
+
```python
|
|
337
|
+
# Stats → Correlations → Outliers → Profile
|
|
338
|
+
get_statistics(sid)
|
|
339
|
+
get_correlation_matrix(sid)
|
|
340
|
+
detect_outliers(sid, method="iqr")
|
|
341
|
+
profile_data(sid)
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
### Export Multiple Formats
|
|
345
|
+
```python
|
|
346
|
+
# Same data, different formats for different uses
|
|
347
|
+
export_csv(sid, "report.xlsx", format="excel") # For business users
|
|
348
|
+
export_csv(sid, "data.parquet", format="parquet") # For data warehouse
|
|
349
|
+
export_csv(sid, "api_response.json", format="json") # For API
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
## Next Steps
|
|
353
|
+
|
|
354
|
+
Congratulations! You've learned the basics of CSV Editor. Continue with:
|
|
355
|
+
|
|
356
|
+
- [Advanced Filtering](./advanced-filtering) - Complex multi-condition filters
|
|
357
|
+
- [Data Transformation](./data-transformation) - Advanced column operations
|
|
358
|
+
- [Statistical Analysis](./statistical-analysis) - In-depth analytics
|
|
359
|
+
- [API Reference](../api/overview) - Complete tool documentation
|
|
360
|
+
|
|
361
|
+
## Need Help?
|
|
362
|
+
|
|
363
|
+
- Check the [API Reference](../api/overview) for detailed tool documentation
|
|
364
|
+
- Visit [GitHub Discussions](https://github.com/santoshray02/csv-editor/discussions) for community support
|
|
365
|
+
- Report issues on [GitHub Issues](https://github.com/santoshray02/csv-editor/issues)
|