Skip to content

Commit 53a8d56

Browse files
committed
Pandas -> pandas (fixes #9) [skip ci]
1 parent 9343c53 commit 53a8d56

File tree

5 files changed

+29
-29
lines changed

5 files changed

+29
-29
lines changed

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Django REST Pandas
22
==================
33

4-
#### [Django REST Framework] + [Pandas] = A Model-driven Visualization API
4+
#### [Django REST Framework] + [pandas] = A Model-driven Visualization API
55

6-
**Django REST Pandas** (DRP) provides a simple way to generate and serve [Pandas] DataFrames via the [Django REST Framework]. The resulting API can serve up CSV (and a number of [other formats](#supported-formats)) for consumption by a client-side visualization tool like [d3.js].
6+
**Django REST Pandas** (DRP) provides a simple way to generate and serve [pandas] DataFrames via the [Django REST Framework]. The resulting API can serve up CSV (and a number of [other formats](#supported-formats)) for consumption by a client-side visualization tool like [d3.js].
77

88
The design philosophy of DRP enforces a strict separation between data and presentation. This keeps the implementation simple, but also has the nice side effect of making it trivial to provide the source data for your visualizations. This capability can often be leveraged by sending users to the same URL that your visualization code uses internally to load the data.
99

@@ -21,12 +21,12 @@ The [climata-viewer] project uses Django REST Pandas and [wq/chart.js] to provid
2121
## Related Work
2222
The field of Python-powered data analysis and visualization is growing, and there are a number of similar solutions that may fit your needs better.
2323

24-
* [Django Pandas] provides a custom ORM model manager with Pandas support. By contrast, Django REST Pandas works at the *view* level, by integrating Pandas via custom Django REST Framework serializers and renderers.
25-
* [DRF-CSV] provides straightforward CSV renderers for use with Django REST Framework. It may be useful if you just want a CSV API and don't have a need for the Pandas DataFrame functionality.
24+
* [Django Pandas] provides a custom ORM model manager with pandas support. By contrast, Django REST Pandas works at the *view* level, by integrating pandas via custom Django REST Framework serializers and renderers.
25+
* [DRF-CSV] provides straightforward CSV renderers for use with Django REST Framework. It may be useful if you just want a CSV API and don't have a need for the pandas DataFrame functionality.
2626
* [mpld3] provides a direct bridge from [matplotlib] to [d3.js], complete with seamless [IPython] integration. It is restricted to the (large) matplotlib chart vocabularly but should be sufficient for many use cases.
2727
* [Bokeh] is a complete client-server visualization platform. It does not leverage d3 or Django, but is notable as a comprehensive, forward-looking approach to addressing similar use cases.
2828

29-
The goal of Django REST Pandas is to provide a generic REST API for serving up Pandas dataframes. In this sense, it is similar to the Plot Server in Bokeh, but more generic in that it does not assume any particular visualization format or technology. Further, DRP is optimized for integration with public-facing Django-powered websites (unlike mpld3 which is primarily intended for use within IPython).
29+
The goal of Django REST Pandas is to provide a generic REST API for serving up pandas dataframes. In this sense, it is similar to the Plot Server in Bokeh, but more generic in that it does not assume any particular visualization format or technology. Further, DRP is optimized for integration with public-facing Django-powered websites (unlike mpld3 which is primarily intended for use within IPython).
3030

3131
In summary, DRP is designed for use cases where:
3232

@@ -37,7 +37,7 @@ In summary, DRP is designed for use cases where:
3737

3838
The following output formats are provided by default. These are provided as [renderer classes] in order to leverage the content type negotiation built into Django REST Framework. This means clients can specify a format via `Accepts: text/csv` or by appending `.csv` to the URL (if the URL configuration below is used).
3939

40-
Format | Content Type | Pandas DataFrame Function | Notes
40+
Format | Content Type | pandas DataFrame Function | Notes
4141
-------|--------------|---------------------------|--------
4242
CSV | `text/csv` | `to_csv()` |
4343
TXT | `text/plain` | `to_csv()` | Useful for testing, as most browsers will download a CSV file instead of displaying it
@@ -110,14 +110,14 @@ urlpatterns = format_suffix_patterns(urlpatterns)
110110
The default `PandasView` will serve up all of the available data from the provided model in a simple tabular form. You can also use a `PandasViewSet` if you are using Django REST Framework's [ViewSets] and [Routers], or a `PandasSimpleView` if you would just like to serve up some data without a Django model as the source.
111111

112112
### Implementation Notes
113-
The underlying implementation is a set of [serializers] that take the normal serializer result and put it into a dataframe. Then, the included [renderers] generate the output using the built in Pandas functionality.
113+
The underlying implementation is a set of [serializers] that take the normal serializer result and put it into a dataframe. Then, the included [renderers] generate the output using the built in pandas functionality.
114114

115-
Perhaps counterintuitively, the CSV renderer is the default in Django REST Pandas, as it is the most stable and useful for API building. While the Pandas JSON serializer is improving, the primary reason for making CSV the default is the compactness it provides over JSON when serializing time series data. This is particularly valuable for Pandas dataframes, in which:
115+
Perhaps counterintuitively, the CSV renderer is the default in Django REST Pandas, as it is the most stable and useful for API building. While the pandas JSON serializer is improving, the primary reason for making CSV the default is the compactness it provides over JSON when serializing time series data. This is particularly valuable for pandas dataframes, in which:
116116

117117
- each record has the same keys, and
118118
- there are (usually) no nested objects
119119

120-
While a normal CSV file only has a single row of column headers, Pandas can produce files with nested columns. This is a useful way to provide metadata about time series that is difficult to represent in a plain CSV file. However, it also makes the resulting CSV more difficult to parse. For this reason, you may be interested in [wq/pandas.js], a d3 extension for loading the complex CSV generated by Pandas Dataframes.
120+
While a normal CSV file only has a single row of column headers, pandas can produce files with nested columns. This is a useful way to provide metadata about time series that is difficult to represent in a plain CSV file. However, it also makes the resulting CSV more difficult to parse. For this reason, you may be interested in [wq/pandas.js], a d3 extension for loading the complex CSV generated by pandas Dataframes.
121121

122122
```javascript
123123
// mychart.js
@@ -141,7 +141,7 @@ function render(error, data) {
141141
You can override the default renderers by setting `PANDAS_RENDERERS` in your `settings.py`, or by overriding `renderer_classes` in your `PandasView` subclass. `PANDAS_RENDERERS` is intentionally set separately from Django REST Framework's own `DEFAULT_RENDERER_CLASSES` setting, as it is likely that you will be mixing DRP views with regular DRF views.
142142

143143
[Django REST Framework]: http://django-rest-framework.org
144-
[Pandas]: http://pandas.pydata.org
144+
[pandas]: http://pandas.pydata.org
145145
[d3.js]: http://d3js.org
146146
[wq.app]: http://wq.io/wq.app
147147
[wq/chart.js]: http://wq.io/docs/chart-js

README.rst

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
Django REST Pandas
22
==================
33

4-
*Django REST Framework + Pandas = A Model-driven Visualization API*
4+
*Django REST Framework + pandas = A Model-driven Visualization API*
55

66
**Django REST Pandas** (DRP) provides a simple way to generate and serve
7-
`Pandas <http://pandas.pydata.org>`__ DataFrames via the `Django REST
7+
`pandas <http://pandas.pydata.org>`__ DataFrames via the `Django REST
88
Framework <http://django-rest-framework.org>`__. The resulting API can
99
serve up CSV (and a number of other formats)
1010
for consumption by a client-side visualization tool like
@@ -46,13 +46,13 @@ and there are a number of similar solutions that may fit your needs
4646
better.
4747

4848
- `Django Pandas <https://github.com/chrisdev/django-pandas/>`__
49-
provides a custom ORM model manager with Pandas support. By contrast,
50-
Django REST Pandas works at the *view* level, by integrating Pandas
49+
provides a custom ORM model manager with pandas support. By contrast,
50+
Django REST Pandas works at the *view* level, by integrating pandas
5151
via custom Django REST Framework serializers and renderers.
5252
- `DRF-CSV <https://github.com/mjumbewu/django-rest-framework-csv>`__
5353
provides straightforward CSV renderers for use with Django REST
5454
Framework. It may be useful if you just want a CSV API and don't have
55-
a need for the Pandas DataFrame functionality.
55+
a need for the pandas DataFrame functionality.
5656
- `mpld3 <http://mpld3.github.io/>`__ provides a direct bridge from
5757
`matplotlib <http://matplotlib.org/>`__ to
5858
`d3.js <http://d3js.org>`__, complete with seamless
@@ -65,7 +65,7 @@ better.
6565
similar use cases.
6666

6767
The goal of Django REST Pandas is to provide a generic REST API for
68-
serving up Pandas dataframes. In this sense, it is similar to the Plot
68+
serving up pandas dataframes. In this sense, it is similar to the Plot
6969
Server in Bokeh, but more generic in that it does not assume any
7070
particular visualization format or technology. Further, DRP is optimized
7171
for integration with public-facing Django-powered websites (unlike mpld3
@@ -95,7 +95,7 @@ Framework. This means clients can specify a format via
9595
configuration below is used).
9696

9797
.. csv-table::
98-
:header: "Format", "Content Type", "Pandas Dataframe Function", "Notes"
98+
:header: "Format", "Content Type", "pandas Dataframe Function", "Notes"
9999
:widths: 50, 150, 70, 500
100100

101101
CSV,``text/csv``,``to_csv()``,
@@ -116,7 +116,7 @@ Getting Started
116116

117117
.. code:: bash
118118
119-
pip install rest-pandas
119+
pip3 install rest-pandas
120120
121121
Usage Example
122122
~~~~~~~~~~~~~
@@ -187,25 +187,25 @@ The underlying implementation is a set of
187187
that take the normal serializer result and put it into a dataframe.
188188
Then, the included
189189
`renderers <https://github.com/wq/django-rest-pandas/blob/master/rest_pandas/renderers.py>`__
190-
generate the output using the built in Pandas functionality.
190+
generate the output using the built in pandas functionality.
191191

192192
Perhaps counterintuitively, the CSV renderer is the default in Django
193193
REST Pandas, as it is the most stable and useful for API building. While
194-
the Pandas JSON serializer is improving, the primary reason for making
194+
the pandas JSON serializer is improving, the primary reason for making
195195
CSV the default is the compactness it provides over JSON when
196-
serializing time series data. This is particularly valuable for Pandas
196+
serializing time series data. This is particularly valuable for pandas
197197
dataframes, in which:
198198

199199
- each record has the same keys, and
200200
- there are (usually) no nested objects
201201

202-
While a normal CSV file only has a single row of column headers, Pandas
202+
While a normal CSV file only has a single row of column headers, pandas
203203
can produce files with nested columns. This is a useful way to provide
204204
metadata about time series that is difficult to represent in a plain CSV
205205
file. However, it also makes the resulting CSV more difficult to parse.
206206
For this reason, you may be interested in
207207
`wq/pandas.js <http://wq.io/docs/pandas-js>`__, a d3 extension for
208-
loading the complex CSV generated by Pandas Dataframes.
208+
loading the complex CSV generated by pandas Dataframes.
209209

210210
.. code:: javascript
211211

README.rst.patch

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
4,5c4
2-
< `Django REST Framework <http://django-rest-framework.org>`__ + `Pandas <http://pandas.pydata.org>`__ = A Model-driven Visualization API
2+
< `Django REST Framework <http://django-rest-framework.org>`__ + `pandas <http://pandas.pydata.org>`__ = A Model-driven Visualization API
33
< ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44
---
5-
> *Django REST Framework + Pandas = A Model-driven Visualization API*
5+
> *Django REST Framework + pandas = A Model-driven Visualization API*
66
10c9
77
< serve up CSV (and a number of `other formats <#supported-formats>`__)
88
---
99
> serve up CSV (and a number of other formats)
1010
98,114c97,107
1111
< +----------+---------------------------------------+-----------------------------+------------------------------------------------------------------------------------------+
12-
< | Format | Content Type | Pandas DataFrame Function | Notes |
12+
< | Format | Content Type | pandas DataFrame Function | Notes |
1313
< +==========+=======================================+=============================+==========================================================================================+
1414
< | CSV | ``text/csv`` | ``to_csv()`` |
1515
< +----------+---------------------------------------+-----------------------------+------------------------------------------------------------------------------------------+
@@ -27,7 +27,7 @@
2727
< +----------+---------------------------------------+-----------------------------+------------------------------------------------------------------------------------------+
2828
---
2929
> .. csv-table::
30-
> :header: "Format", "Content Type", "Pandas Dataframe Function", "Notes"
30+
> :header: "Format", "Content Type", "pandas Dataframe Function", "Notes"
3131
> :widths: 50, 150, 70, 500
3232
>
3333
> CSV,``text/csv``,``to_csv()``,

rest_pandas/renderers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
class PandasBaseRenderer(BaseRenderer):
1616
"""
17-
Renders DataFrames using their built in Pandas implementation.
17+
Renders DataFrames using their built in pandas implementation.
1818
Only works with serializers that return DataFrames as their data object.
1919
Uses a StringIO to capture the output of dataframe.to_[format]()
2020
"""

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from setuptools import setup, find_packages
33

44
LONG_DESCRIPTION = """
5-
Serves up Pandas dataframes via the Django REST Framework for client-side (i.e. d3.js) visualizations
5+
Serves up pandas dataframes via the Django REST Framework for client-side (i.e. d3.js) visualizations
66
"""
77

88

0 commit comments

Comments
 (0)