Metadata-Version: 2.4
Name: yashdw
Version: 1.0.0
Summary: Data Wrangling Practical 1 solutions with a Jupyter shortcut
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: numpy
Requires-Dist: pandas
Provides-Extra: notebook
Requires-Dist: ipython; extra == "notebook"
Requires-Dist: jupyter; extra == "notebook"

# yashdw – Data Wrangling Practical 1

A small Python package holding solutions to the 10 questions of
**Data Wrangling Practical 1**, runnable from Jupyter with `yashdw.q1()` … `yashdw.q10()`
or the shortcut `yashdw.1` … `yashdw.10`.

## The 10 questions (from the practical file)

| # | Task | Libraries |
|---|------|-----------|
| 1 | `data = [25..60]`: mean, median, max, min | statistics |
| 2 | marks: mean, median, mode, range | statistics |
| 3 | production: mean, variance, std, max, min | numpy |
| 4 | NumPy array: mean, median, variance, std (2 decimals) | numpy |
| 5 | DataFrame of machine output: mean, median, std, `describe()` | pandas |
| 6 | 20 random integers 50–100: mean, variance, std, max, min | numpy |
| 7 | inspection data: mean, median, variance, std, low/high variation | numpy |
| 8 | Machine A: mean, std, variance, coefficient of variation, consistency | numpy |
| 9 | Machine A vs B: means, stds, more consistent machine | numpy |
| 10 | process measurements: mean, median, mode, variance, std, stability | numpy, statistics |

The full question text of each is in its function docstring: `yashdw.question(3)`.

Notes on the code: Q.4 uses the array exactly as the question lists it
(`[12,15,18,20,22,24,26,28,30,32]`). Your original notebook was missing the `28`.
Q.6 is random, so its numbers change on every run.

## Usage

```python
import yashdw

yashdw.q1()        # plain function call - works everywhere
yashdw.1           # shortcut (see below)
yashdw.run(5)      # same as q5()
yashdw.question(8) # print the question text
yashdw.show(8)     # print the source code of solution 8
yashdw.insert(8)   # put solution 8's code into a NEW editable cell
```

From a terminal (no Jupyter needed): `python -m yashdw 3` or `python -m yashdw all`.

## How the `yashdw.1` shortcut works (and its limits)

* `yashdw.1` is **not valid Python**: the tokenizer reads `.1` as a number, and names
  cannot start with a digit. A real attribute is impossible.
* So `import yashdw` registers an **IPython input transformer**. Before a cell runs, it
  rewrites a line that is *exactly* `yashdw.1` (1–10) into `yashdw.q1()`.
* **It executes the solution. It does NOT insert code into your cell.** The cell
  keeps showing `yashdw.1`, and the output appears below it.
* To get *editable code*, use `yashdw.insert(1)`. It uses IPython's `set_next_input`
  to create a new cell below containing the code. That works in IPython and in
  Jupyter Notebook/JupyterLab, but I could not test it on your frontend. Writing into the *same*
  cell would need a Jupyter frontend extension, which this package does not include.
* The shortcut only works when the line is by itself (`yashdw.1` or `yashdw.1;`) in
  IPython/Jupyter. In plain `python` scripts or the standard `python` shell use `yashdw.q1()`.
* If the shortcut is not active, run `%load_ext yashdw` or `yashdw.enable_shortcut()`.

## Installation

Requirements: Python 3.8+, `numpy`, `pandas` (and `jupyter`/`ipython` for notebooks).
Installing needs internet **unless** you prepared the wheels beforehand (next section).

### Windows (Command Prompt / PowerShell)
```
cd path\to\yashdw_module
py -m pip install -r requirements.txt
py -m pip install .
```

### Linux / macOS
```
cd path/to/yashdw_module
python3 -m pip install -r requirements.txt
python3 -m pip install .
```

### Android / Termux
```
pkg update
pkg install python python-numpy python-pandas
pip install ipython notebook      # Jupyter on Termux can be difficult; ipython alone is fine
cd yashdw_module && pip install .
```
Termux packages numpy/pandas through `pkg`; building them with pip is slow and often fails.
Jupyter Notebook on Termux can need extra build tools. `ipython` also supports `yashdw.1`.

### Jupyter
Install into the same Python that runs Jupyter. From inside a notebook:
```python
%pip install /full/path/to/yashdw_module
```
Then `import yashdw`.

### Without installing at all
Put the `yashdw/` folder next to your notebook (or add its parent to `sys.path`).
It only needs numpy and pandas to be installed already.

## Offline use (prepare while online)

Offline works **only for things already downloaded or installed**.

1. **While online** (the five-minute window), in the project folder:
   ```
   python install.py --wheels      # downloads numpy, pandas, etc. wheels into ./wheelhouse
   python install.py               # installs everything now
   ```
   Pip stores wheels for *your* OS and Python version only. Prepare on the same
   machine/Python you will use.
2. **Later, offline**:
   ```
   python install.py --offline     # installs from ./wheelhouse, no internet
   python install.py --check       # runs all 10 solutions
   ```
   If the packages are already installed (step 1, second command), you need nothing more:
   `import yashdw` works offline.

Also prepare beforehand: confirm `jupyter notebook` starts, and run `python install.py --check`.

## Optional: publishing to PyPI (not done)

This package has **not** been published. The ZIP works locally without PyPI. If you
ever want to publish: `pip install build twine`, `python -m build`, then
`twine upload dist/*` with your own PyPI account. The name `yashdw` may already be taken.

## Files

```
yashdw/__init__.py     shortcut, helpers, IPython transformer
yashdw/solutions.py    q1() ... q10()
yashdw/__main__.py     python -m yashdw N
install.py             install / offline helper
examples/practical_examples.ipynb
```
