Bizarre errors from Pandas when using the decorator
See original GitHub issueWanted to use this but I get bizarre errors from Pandas when I add the decorator to my test function.
The test and the code being tested do not execute any Pandas methods directly, but one of my project modules imports pandas - the error is occurring at import time.
File "/Users/anentropic/Documents/Dev/Work/anentropic/backend/stats/users.py", line 6, in <module>
import pandas as pd
File "/Users/anentropic/.virtualenvs/anentropic/lib/python2.7/site-packages/pandas/__init__.py", line 7, in <module>
from . import hashtable, tslib, lib
File "pandas/tslib.pyx", line 614, in init pandas.tslib (pandas/tslib.c:81486)
File "pandas/tslib.pyx", line 573, in pandas.tslib.NaTType.__new__ (pandas/tslib.c:12539)
TypeError: __new__() takes exactly one argument (4 given)
Issue Analytics
- State:
- Created 8 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
The @profile decorator from memory_profiler is changing the ...
I am using the library memory_profiler to run some memory profiling and it seems to works fine, except if I use the @profile...
Read more >5 Advanced Tips on Python Decorators | by Michael Berk
In chapter 7 of Fluent Python, Luciano Ramalho discusses decorators and closures. They are not super common in basic DS work, however as...
Read more >Primer on Python Decorators
Decorating Classes; Nesting Decorators; Decorators With Arguments; Both Please, But Never Mind the ... Unfortunately, running this code raises an error:.
Read more >Error Handling in Python using Decorators - GeeksforGeeks
Error Handling in Python using Decorators ; def decorator_example(func):. print ( "Decorator called" ). # defining inner decorator function. def ...
Read more >Error with Table.from_pandas - Hail Query & hailctl
Hi I'm using hail 0.2.83 and am having a problem with creating a table from a ... pop_clf File <decorator-gen-1085>:2, in from_pandas(df, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Just ran into this problem too – my frozen test code was importing Pandas, and Pandas import failed with
I got it to work by explicitly importing Pandas before the test code runs.
To give a concrete example of this suggestion from @ze-phyr-us:
I was able to do this by adding
import pandas
to my globalconftest.py
.