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

week4/lfw_dataset.py #14

Closed
zuenko opened this issue Aug 12, 2018 · 4 comments
Closed

week4/lfw_dataset.py #14

zuenko opened this issue Aug 12, 2018 · 4 comments

Comments

@zuenko
Copy link

zuenko commented Aug 12, 2018

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-4-856143fffc33> in <module>()
      8 #Those attributes will be required for the final part of the assignment (applying smiles), so please keep them in mind
      9 from lfw_dataset import load_lfw_dataset
---> 10 data,attrs = load_lfw_dataset(dimx=36,dimy=36)
     11 
     12 #preprocess faces

~/GitHub/intro-to-dl/week4/lfw_dataset.py in load_lfw_dataset(use_raw, dx, dy, dimx, dimy)
     52 
     53     # preserve photo_ids order!
---> 54     all_attrs = photo_ids.merge(df_attrs, on=('person', 'imagenum')).drop(["person", "imagenum"], axis=1)
     55 
     56     return all_photos, all_attrs

~/anaconda3/lib/python3.6/site-packages/pandas/core/frame.py in merge(self, right, how, on, left_on, right_on, left_index, right_index, sort, suffixes, copy, indicator, validate)
   6377                      right_on=right_on, left_index=left_index,
   6378                      right_index=right_index, sort=sort, suffixes=suffixes,
-> 6379                      copy=copy, indicator=indicator, validate=validate)
   6380 
   6381     def round(self, decimals=0, *args, **kwargs):

~/anaconda3/lib/python3.6/site-packages/pandas/core/reshape/merge.py in merge(left, right, how, on, left_on, right_on, left_index, right_index, sort, suffixes, copy, indicator, validate)
     58                          right_index=right_index, sort=sort, suffixes=suffixes,
     59                          copy=copy, indicator=indicator,
---> 60                          validate=validate)
     61     return op.get_result()
     62 

~/anaconda3/lib/python3.6/site-packages/pandas/core/reshape/merge.py in __init__(self, left, right, how, on, left_on, right_on, axis, left_index, right_index, sort, suffixes, copy, indicator, validate)
    552         # validate the merge keys dtypes. We may need to coerce
    553         # to avoid incompat dtypes
--> 554         self._maybe_coerce_merge_keys()
    555 
    556         # If argument passed to validate,

~/anaconda3/lib/python3.6/site-packages/pandas/core/reshape/merge.py in _maybe_coerce_merge_keys(self)
    976             # incompatible dtypes GH 9780, GH 15800
    977             elif is_numeric_dtype(lk) and not is_numeric_dtype(rk):
--> 978                 raise ValueError(msg)
    979             elif not is_numeric_dtype(lk) and is_numeric_dtype(rk):
    980                 raise ValueError(msg)

ValueError: You are trying to merge on int64 and object columns. If you wish to proceed you should use pd.concat
@ZEMUSHKA
Copy link
Contributor

I cannot reproduce your error, it works fine both in Google Colab and Coursera Jupyter.
What version of pandas are you using?
Also try to re-download files for week4, maybe you have corrupted files.

@zuenko
Copy link
Author

zuenko commented Aug 12, 2018

pandas 0.23.0
I redownload files and run it again, still got the same error.
Also, there are some problems with downloading week materials in Colab. They do not download, so I just used:

! wget http://www.cs.columbia.edu/CAVE/databases/pubfig/download/lfw_attributes.txt
! wget http://vis-www.cs.umass.edu/lfw/lfw-deepfunneled.tgz
! wget http://vis-www.cs.umass.edu/lfw/lfw.tgz

@ZEMUSHKA
Copy link
Contributor

Colab has pandas 0.22.0, I'll take a look at 0.23.
Files download just fine in Colab for me, maybe you have a bad instance or something like that, we cannot control that.

@ZEMUSHKA
Copy link
Contributor

ZEMUSHKA commented Aug 12, 2018

Fixed for new pandas in master:

df_attrs.columns = list(df_attrs.columns)[1:] + ["NaN"]
df_attrs = df_attrs.drop("NaN", axis=1)

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

2 participants