ENH: Add Redis IO functionality
State: closed

Adds two primary IO methods: to_redis() and read_redis() 

TL;DR: Serializes DataFrames in and out of Redis. I've used a version of this code in production previously to share a cached DF across multiple worker processes. 

- [x] tests added / passed
- [x] Ensure all linting tests pass, see [here](https://pandas.pydata.org/pandas-docs/dev/development/contributing.html#code-standards) for how to run them
- [x] whatsnew entry


Labels:
name: Enhancement
name: IO Data
description: IO issues that don't fit into a more specific label

Comments:
Hello @Jflick58! Thanks for updating this PR. We checked the lines you've touched for [PEP 8](https://www.python.org/dev/peps/pep-0008) issues, and found:



* In the file [`pandas/core/frame.py`](https://github.com/pandas-dev/pandas/blob/21d13c7746aa4d91e91593581b1d04a681003421/pandas/core/frame.py):

> [Line 2326:89](https://github.com/pandas-dev/pandas/blob/21d13c7746aa4d91e91593581b1d04a681003421/pandas/core/frame.py#L2326): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (145 > 88 characters)
> [Line 2328:89](https://github.com/pandas-dev/pandas/blob/21d13c7746aa4d91e91593581b1d04a681003421/pandas/core/frame.py#L2328): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (125 > 88 characters)
> [Line 2331:89](https://github.com/pandas-dev/pandas/blob/21d13c7746aa4d91e91593581b1d04a681003421/pandas/core/frame.py#L2331): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (175 > 88 characters)
> [Line 2332:89](https://github.com/pandas-dev/pandas/blob/21d13c7746aa4d91e91593581b1d04a681003421/pandas/core/frame.py#L2332): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (188 > 88 characters)
> [Line 2334:89](https://github.com/pandas-dev/pandas/blob/21d13c7746aa4d91e91593581b1d04a681003421/pandas/core/frame.py#L2334): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (115 > 88 characters)
> [Line 2341:89](https://github.com/pandas-dev/pandas/blob/21d13c7746aa4d91e91593581b1d04a681003421/pandas/core/frame.py#L2341): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (160 > 88 characters)
> [Line 2343:89](https://github.com/pandas-dev/pandas/blob/21d13c7746aa4d91e91593581b1d04a681003421/pandas/core/frame.py#L2343): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (213 > 88 characters)



* In the file [`pandas/io/redis.py`](https://github.com/pandas-dev/pandas/blob/21d13c7746aa4d91e91593581b1d04a681003421/pandas/io/redis.py):

> [Line 36:89](https://github.com/pandas-dev/pandas/blob/21d13c7746aa4d91e91593581b1d04a681003421/pandas/io/redis.py#L36): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (108 > 88 characters)
> [Line 53:89](https://github.com/pandas-dev/pandas/blob/21d13c7746aa4d91e91593581b1d04a681003421/pandas/io/redis.py#L53): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (120 > 88 characters)
> [Line 57:89](https://github.com/pandas-dev/pandas/blob/21d13c7746aa4d91e91593581b1d04a681003421/pandas/io/redis.py#L57): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (105 > 88 characters)
> [Line 73:89](https://github.com/pandas-dev/pandas/blob/21d13c7746aa4d91e91593581b1d04a681003421/pandas/io/redis.py#L73): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (203 > 88 characters)
> [Line 75:89](https://github.com/pandas-dev/pandas/blob/21d13c7746aa4d91e91593581b1d04a681003421/pandas/io/redis.py#L75): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (125 > 88 characters)
> [Line 78:89](https://github.com/pandas-dev/pandas/blob/21d13c7746aa4d91e91593581b1d04a681003421/pandas/io/redis.py#L78): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (175 > 88 characters)
> [Line 79:89](https://github.com/pandas-dev/pandas/blob/21d13c7746aa4d91e91593581b1d04a681003421/pandas/io/redis.py#L79): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (188 > 88 characters)
> [Line 81:89](https://github.com/pandas-dev/pandas/blob/21d13c7746aa4d91e91593581b1d04a681003421/pandas/io/redis.py#L81): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (115 > 88 characters)
> [Line 87:89](https://github.com/pandas-dev/pandas/blob/21d13c7746aa4d91e91593581b1d04a681003421/pandas/io/redis.py#L87): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (170 > 88 characters)
> [Line 89:89](https://github.com/pandas-dev/pandas/blob/21d13c7746aa4d91e91593581b1d04a681003421/pandas/io/redis.py#L89): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (226 > 88 characters)
> [Line 110:89](https://github.com/pandas-dev/pandas/blob/21d13c7746aa4d91e91593581b1d04a681003421/pandas/io/redis.py#L110): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (132 > 88 characters)
> [Line 113:32](https://github.com/pandas-dev/pandas/blob/21d13c7746aa4d91e91593581b1d04a681003421/pandas/io/redis.py#L113): [E711](https://duckduckgo.com/?q=pep8%20E711) comparison to None should be 'if cond is not None:'
> [Line 126:89](https://github.com/pandas-dev/pandas/blob/21d13c7746aa4d91e91593581b1d04a681003421/pandas/io/redis.py#L126): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (153 > 88 characters)
> [Line 138:16](https://github.com/pandas-dev/pandas/blob/21d13c7746aa4d91e91593581b1d04a681003421/pandas/io/redis.py#L138): [E712](https://duckduckgo.com/?q=pep8%20E712) comparison to True should be 'if cond is True:' or 'if cond:'



* In the file [`pandas/tests/io/test_redis.py`](https://github.com/pandas-dev/pandas/blob/21d13c7746aa4d91e91593581b1d04a681003421/pandas/tests/io/test_redis.py):

> [Line 12:89](https://github.com/pandas-dev/pandas/blob/21d13c7746aa4d91e91593581b1d04a681003421/pandas/tests/io/test_redis.py#L12): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (91 > 88 characters)
> [Line 57:89](https://github.com/pandas-dev/pandas/blob/21d13c7746aa4d91e91593581b1d04a681003421/pandas/tests/io/test_redis.py#L57): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (124 > 88 characters)
> [Line 82:89](https://github.com/pandas-dev/pandas/blob/21d13c7746aa4d91e91593581b1d04a681003421/pandas/tests/io/test_redis.py#L82): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (129 > 88 characters)
> [Line 93:89](https://github.com/pandas-dev/pandas/blob/21d13c7746aa4d91e91593581b1d04a681003421/pandas/tests/io/test_redis.py#L93): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (199 > 88 characters)
> [Line 103:89](https://github.com/pandas-dev/pandas/blob/21d13c7746aa4d91e91593581b1d04a681003421/pandas/tests/io/test_redis.py#L103): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (203 > 88 characters)
> [Line 114:89](https://github.com/pandas-dev/pandas/blob/21d13c7746aa4d91e91593581b1d04a681003421/pandas/tests/io/test_redis.py#L114): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (109 > 88 characters)
> [Line 130:89](https://github.com/pandas-dev/pandas/blob/21d13c7746aa4d91e91593581b1d04a681003421/pandas/tests/io/test_redis.py#L130): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (95 > 88 characters)



##### Comment last updated at 2021-09-05 19:24:55 UTC
@github-actions pre-commit
Do the checks actually implement the changes to environment.yml when it builds? I looked at the pipeline logs and it looks like   they are using whatever is in the current version of the Docker image, hence why the checks are failing with optional dependency errors. 
No they don‘t in the ci. You have to run them locally 
agree with @mroeschke here and would be -1 as well

the io are about reading snd writing formats and not to services (except sql which is pretty general)

Gotcha, apologies for not opening an issue first. I appreciate you folks taking the time to review this. 

I originally designed this as a separate package that leverages dataframe accessors. I can pivot back to that and release it in PyPI in that form.  I think there's some value in abstracting (albeit somewhat leakily) the Redis functions. Would you be cool if I PR'd the docs for the pandas ecosystem to link to it once it's up? 
> Gotcha, apologies for not opening an issue first. I appreciate you folks taking the time to review this.
> 
> I originally designed this as a separate package that leverages dataframe accessors. I can pivot back to that and release it in PyPI in that form. I think there's some value in abstracting (albeit somewhat leakily) the Redis functions. Would you be cool if I PR'd the docs for the pandas ecosystem to link to it once it's up?

@Jflick58 absolutely would be happy to link in ecosytem (pls open a PR when ready).

thanks!