In week 6 jupyter notebook, it reports an error when I'm running the following lines. I was trying to solve the problem by replacing as_matrix with to_numpy. But the relevant discussion mentions that they are slightly different. So can you please tell me how to correct my the sample code? Thanks for your help!
ldaDFV = ldaDF[:10][['topic_%d' %x for x in range(10)]]
ldaDFVisN = ldaDF[:10][['name']]
ldaDFVis = ldaDFV.as_matrix(columns=None)
ldaDFVisNames = ldaDFVisN.as_matrix(columns=None)
ldaDFV
error message
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-71-ce6047e5b0d8> in <module>
1 ldaDFV = ldaDF[:10][['topic_%d' %x for x in range(10)]]
2 ldaDFVisN = ldaDF[:10][['name']]
----> 3 ldaDFVis = ldaDFV.as_matrix(columns=None)
4 ldaDFVisNames = ldaDFVisN.as_matrix(columns=None)
5 ldaDFV
~/opt/anaconda3/lib/python3.8/site-packages/pandas/core/generic.py in __getattr__(self, name)
5137 if self._info_axis._can_hold_identifiers_and_holds_name(name):
5138 return self[name]
-> 5139 return object.__getattribute__(self, name)
5140
5141 def __setattr__(self, name: str, value) -> None:
AttributeError: 'DataFrame' object has no attribute 'as_matrix'
In week 6 jupyter notebook, it reports an error when I'm running the following lines. I was trying to solve the problem by replacing
as_matrix
withto_numpy
. But the relevant discussion mentions that they are slightly different. So can you please tell me how to correct my the sample code? Thanks for your help!error message