A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/wq/django-rest-pandas/issues/34 below:

Calling `PandasBaseRenderer().render(data)` throws `TypeError` · Issue #34 · wq/django-rest-pandas · GitHub

For personal reasons, I wanted to call the PandasCSVRenderer on a dataframe outside of a view.

Because renderer_context is defaulted to None, the following code will throw TypeError: argument of type 'NoneType' is not iterable:

from rest_pandas import renderers


data_frame = pandas.DataFrame(some_data)
print renderers.PandasCSVRenderer().render(data_frame)
>>>TypeError: argument of type 'NoneType' is not iterable

I suggest two options to fix the following code:

if 'response' in renderer_context:
  1. Change the if statement:
if renderer_context and 'response' in renderer_context:
  1. Add the following at the top of the function:
if renderer_context is None:
    renreder_context = {}
...

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4