Comments (3)
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.
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.
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)
- Can't get code on page 137 to work
- In `adult citizens` problem you don't include `education.num` in number column
- Why don't you use average auc (but list of auc's)?
- Is the keras model in adult sensus data realy is the best? HOT 1
- Typo on page 5
- Hard to differentiate code from comments HOT 1
- code missing create_folds.py missing HOT 1
- numpy version is conflicting HOT 3
- Error while loading the vectors of crawl-300d-2M.vec
- csv files used in the book HOT 3
- fillna() issue
- Correction in Page 37
- keras model translation to pytorch doesn't perform as expected
- Arranging machine learning projects as GH template HOT 2
- load_vectors - Memory Issue
- a version of the book with an index or table of contents?
- Hello author, I encountered the following installation package error when I used your environment.yml to create the environment. I tried to update conda, pip and the corresponding mirror source, but still failed to solve it. How can I solve this problem?
- Supervised Learning - First example MNIST data HOT 1
- Can I help you translate the book into Chinese? HOT 4
- Bug in page 213 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from approachingalmost.