GithubHelp home page GithubHelp logo

Comments (3)

NakulGoswami avatar NakulGoswami commented on May 20, 2024

Hi Abhishek,
In addition,
when I try to run the first code in the book, I get the following error.
I am sure it is somenthing simple, but do please let me know how to proceed?
Is there an updated code list for your book that you can point me to because that would be helpful.

Thanks
Nakul

TypeError Traceback (most recent call last)
TypeError: '(1, slice(None, None, None))' is an invalid key

in
15 pixel_values, targets = data
16 targets = targets.astype(int)
---> 17 single_image = pixel_values[1, :].reshape(28, 28)
18 plt.imshow(single_image, cmap='gray')
19 tsne = manifold.TSNE(n_components=2, random_state=42)
~\Anaconda3\lib\site-packages\pandas\core\frame.py in getitem(self, key)
3022 if self.columns.nlevels > 1:
3023 return self._getitem_multilevel(key)
-> 3024 indexer = self.columns.get_loc(key)
3025 if is_integer(indexer):
3026 indexer = [indexer]
~\Anaconda3\lib\site-packages\pandas\core\indexes\base.py in get_loc(self, key, method, tolerance)
3078 casted_key = self._maybe_cast_indexer(key)
3079 try:
-> 3080 return self._engine.get_loc(casted_key)
3081 except KeyError as err:
3082 raise KeyError(key) from err
pandas_libs\index.pyx in pandas._libs.index.IndexEngine.get_loc()
pandas_libs\index.pyx in pandas._libs.index.IndexEngine.get_loc()

from approachingalmost.

kaliappan01 avatar kaliappan01 commented on May 20, 2024

Hi Abhishek,
I recently bought your book.
I get the following error when I ren the code that is ritten on page 19.

clf.fit(df_train[cols], df_train.quality)
AttributeError: 'list' object has no attribute 'fit'

Can you help with the accurate code?
Thanks
Nakul

Hello Nakul , I fear you have not initialized the model variable clf correctly .
Can u post a pic or snippet of your code ?

from approachingalmost.

syriacus99 avatar syriacus99 commented on May 20, 2024

Hi Abhishek, In addition, when I try to run the first code in the book, I get the following error. I am sure it is somenthing simple, but do please let me know how to proceed? Is there an updated code list for your book that you can point me to because that would be helpful.

Thanks Nakul

TypeError Traceback (most recent call last) TypeError: '(1, slice(None, None, None))' is an invalid key

in 15 pixel_values, targets = data 16 targets = targets.astype(int) ---> 17 single_image = pixel_values[1, :].reshape(28, 28) 18 plt.imshow(single_image, cmap='gray') 19 tsne = manifold.TSNE(n_components=2, random_state=42) ~\Anaconda3\lib\site-packages\pandas\core\frame.py in getitem(self, key) 3022 if self.columns.nlevels > 1: 3023 return self._getitem_multilevel(key) -> 3024 indexer = self.columns.get_loc(key) 3025 if is_integer(indexer): 3026 indexer = [indexer] ~\Anaconda3\lib\site-packages\pandas\core\indexes\base.py in get_loc(self, key, method, tolerance) 3078 casted_key = self._maybe_cast_indexer(key) 3079 try: -> 3080 return self._engine.get_loc(casted_key) 3081 except KeyError as err: 3082 raise KeyError(key) from err pandas_libs\index.pyx in pandas._libs.index.IndexEngine.get_loc() pandas_libs\index.pyx in pandas._libs.index.IndexEngine.get_loc()

TypeError Traceback (most recent call last)
TypeError: '(1, slice(None, None, None))' is an invalid key
To solve this problem, you should to change code to "single_image = pixel_values[1, :].reshape(28, 28)" .It works

from approachingalmost.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.