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

DFPLY not working.....at all #64

Closed
jaybundy opened this issue Aug 21, 2018 · 9 comments
Closed

DFPLY not working.....at all #64

jaybundy opened this issue Aug 21, 2018 · 9 comments

Comments

@jaybundy
Copy link

jaybundy commented Aug 21, 2018

This was never an issue. It should be deleted.

@sharpe5
Copy link

sharpe5 commented Aug 21, 2018 via email

@sharpe5
Copy link

sharpe5 commented Aug 21, 2018 via email

@jaybundy
Copy link
Author

Thanks for timely support.
It doesn't seem to matter. Running the above code snippet will produce the error I included, even if I don't actually call the select function.

The actual example code I'm trying to execute comes from:
https://towardsdatascience.com/dplyr-style-data-manipulation-with-pipes-in-python-380dcb137000

from dfply import *
import pandas as pd

flight_data = pd.read_csv('nycflights13.csv')
flight_data.head()

(flight_data >>
select(X.origin, X.dest, X.hour))

Here is the full error message:
File "/Users/Jay/Programming/VSCode/Python/Google_python_class/Other_python_lessons/dfply1.py", line 3, in
from dfply import *
File "/Users/Jay/Programming/VSCode/Python/Google_python_class/Other_python_lessons/dfply.py", line 11, in
dfply.select(X.origin, X.dest, X.hour))
AttributeError: module 'dfply' has no attribute 'select'

@jaybundy
Copy link
Author

Interestingly,

If I just run this code:

import os
import pandas as pd
import dfply

print(dfply)

I still get:
AttributeError: module 'dfply' has no attribute 'select'

@kieferk
Copy link
Owner

kieferk commented Aug 28, 2018

Hello there. What version of python are you using? I don't think it would matter for this specifically, but dfply only works for python 3 now in case you're using python 2...

Can you open up a jupyter notebook or ipython console of and type:
from dfply import *

Then see if select is in the namespace?

@jaybundy
Copy link
Author

Version 3.7.0. Interestingly, I seem to be able to get the code to work fine using the interpreter interactively. But when I try to use the package in a script (I write scripts in VS Code), even trying to run "import dfply" only with absolutely no other lines of code, I still get the message:

AttributeError: module 'dfply' has no attribute 'select'

That's weird, because at that point I haven't referenced select at all (as in the original post). But I have the same problem with dplython. Works fine interactively, can't use it in a script, claims it doesn't have select...but in both cases select shows up in help as well as dir and seems to work fine interactively.

@kieferk
Copy link
Owner

kieferk commented Aug 29, 2018

That is odd for sure. In the code above you posted:

import os
import pandas as pd
import dfply

print(dfply)

Could you paste the exact error message you get here?

@jaybundy
Copy link
Author

I believe I figured it out. I was naming the module I used to test the package dfply.py...which obviously broke the import. I'm so sorry to have troubled you guys over such a novice error. But I am very, very grateful for the persistent assistance. Happy Pythoning and Thanks!

@sharpe5
Copy link

sharpe5 commented Aug 31, 2018

Ah, that makes sense.

I've done the same thing before but with a different package.

I think every single Python expert makes this mistake at least once in their learning curve.

Glad its sorted!

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

3 participants