Dear PadhAI,
Requesting you to please resolve the below:
1)meaning of the below ?
def create_df(nRows,nCols,maxRand=10):
arr=np.random.randint(0,maxRand,(nRows,nCols))
df=pd.DataFrame(arr)
df.index=['R'+str(x) for x in np.arange(1,nRows+1)]
df.columns=['C'+str(x) for x in np.arange(1,nCols+1)]
return df
2)input: df['mass_'] is df.Mass
output :AttributeError Traceback (most recent call last)
in ()
----> 1 df[‘mass_’] is df.Mass/usr/local/lib/python3.6/dist-packages/pandas/core/generic.py in getattr(self, name)
5272 if self._info_axis._can_hold_identifiers_and_holds_name(name):
5273 return self[name]
-> 5274 return object.getattribute(self, name)
5275
5276 def setattr(self, name: str, value) -> None:AttributeError: ‘DataFrame’ object has no attribute ‘Mass’
also, what is the meaning of the code
- df[‘pop’] is df.pop----------meaning of the code ??