Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NameError: name 'reduce' is not defined #89

Closed
BlakeTrebelhorn opened this issue Jun 21, 2017 · 0 comments
Closed

NameError: name 'reduce' is not defined #89

BlakeTrebelhorn opened this issue Jun 21, 2017 · 0 comments

Comments

@BlakeTrebelhorn
Copy link

BlakeTrebelhorn commented Jun 21, 2017

I'm getting this error when trying to plot with matplotlib. Here's my code

result = %sql select Month, KB_Over...
%matplotlib inline
result.plot()

Here's the output:

---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-14-083688faac41> in <module>()
----> 1 result.plot()

C:\Users\{me}\AppData\Local\Continuum\Anaconda3\lib\site-packages\sql\run.py in plot(self, title, 
**kwargs)
    197         self.guess_plot_columns()
    198         self.x = self.x or range(len(self.ys[0]))
--> 199         coords = reduce(operator.add, [(self.x, y) for y in self.ys])
    200         plot = plt.plot(*coords, **kwargs)
    201         if hasattr(self.x, 'name'):

NameError: name 'reduce' is not defined

Solution

Just go to C:\Users\{user}\AppData\Local\Continuum\Anaconda3\lib\site-packages\sql\run.py
and add from functools import reduce at the top.

catherinedevlin added a commit that referenced this issue Feb 6, 2019
pmfischer pushed a commit to pmfischer/ipython-sql that referenced this issue Sep 8, 2023
* Add: log_call for historgram & boxplot

* Add: log_call for historgram & boxplot

* Add: log_call for historgram & boxplot

* WIP: checking decorator method called

* Add: histogram test

* Refract: share mock_log_api as fixture

* Add: test for DataFrame

* Fix: lint

* Add: sqlrender

* Add: execute

* Fix: test boxplot fail

* Add: CHANGELOG doc

* Add: store csv to tmp folder

* Fix: add prefix to CHANGELOG

* Fix: test case

* trigger rebuild

* Change: Feature -> Fix

---------

Co-authored-by: Tony Kuo <tonykuo@Tonys-MacBook-Pro.local>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant