Posts

Showing posts from August, 2021

Convert dataframe values to a list

Image
<class 'pandas.core.frame.DataFrame'> --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-5-18d68697e7bd> in <module> 1 a = df . quantile ( [ 0.25 , 0.50 , 0.75 ] ) ; 2 print ( type ( a ) ) ----> 3 a = a . tolist ( ) 4 print ( type ( a ) ) ~\.conda\envs\pybase\lib\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 'tolist' Oftentimes we want to convert a dataframe or a column of a dataframe to a list. the pandas function tol...