Skip to main content

fast pandas selction and indexing

Project description

# fastIndex
awesome way to select from pandas multi index and more

**Warning! this repository is on early develoapment stage!**

installation:
```
pip install fastindex
```
configuration:

```python
from fastindex import fast_index
import pandas as pd
#expanding pandas with fastindex
fast_index(pd)
```
example usage:
```python
#setting pandas MultiIndex
df = read_csv("data.csv")
df.set_index(["Country","City","District","first_name","Age","ID"],inplace=True)
df.sort_index(inplace=True)
```

the magic starts here:
### Basic Selection
- **Regular Pandas:**
```python
df.loc[(slice(None),slice(None),slice(None),slice(None),24),:]
```

- **With fastindex**
```python
df.fidx.slice(Age=24)
```

### Ranges
- **Regular Pandas:**
```python
df.loc[("Spain",slice(None),slice(None),slice(None),slice(23,25)),:]
```
- **With fastindex**
```python
df.fidx.slice(Age=slice(23,25),Country="Spain")
```


### Selecting columns
- **Regular Pandas:**
```python
df.loc[("Spain",slice(None),slice(None),slice(None),slice(23,25)),["last_name"]]
```
- **With fastindex**
```python
df.fidx.slice(Age=slice(23,25),Country="Spain",columns = ["last_name"])
```


### setting values using f_slice:
```python
slc = df.fidx.f_slice(Age=slice(23,25),Country="Spain")
df.loc[slc,"last_name"] = "Leonardo"
```


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

fastindex-0.0.3-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file fastindex-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: fastindex-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

File hashes

Hashes for fastindex-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e1f27563948f9915f8a2e86c2eb6e49554c196a940bb49faec01e818470efca8
MD5 1c1651b552bb1814cea51b5d25210c7c
BLAKE2b-256 af2e29db3ac9ca2de5fbb43d51c26839f41389f3803224ac08b01915e990c555

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page