My code below:
i
My output show below:
I tried as below: but it give error.
test.mean([0,3])
i
mport glob import pandas as pd path =r'D:\Mekala_Backupdata\PythonCodes\InputFiles' # use your path allFiles = glob.glob(path + "/*.csv") frame = pd.DataFrame() list_ = [] for file_ in allFiles: df = pd.read_csv(file_,index_col=None, header=0) # df = pd.read_csv(file_,index_col=None) list_.append(df) frame = pd.concat(list_) test=frame.dropna()my data is stored in test.
My output show below:
Output:test
Out[53]:
AAB BT 2 5 5.1
0 YUT HYT 89.0 52.0 3.0
4 YHT JU 25.0 63.0 2.0
0 YUT HYT 89.0 52.0 3.0
4 YHT JU 25.0 63.0 2.0
0 YUT HYT 89.0 52.0 3.0
4 YHT JU 25.0 63.0 2.0
but I want to calculate 3rd row mean and 4th row mean.I tried as below: but it give error.
test.mean([0,3])
Error:Traceback (most recent call last):
File "<ipython-input-54-e915aed94ad8>", line 1, in <module>
test.mean([0,3])
File "C:\Users\user\Anaconda3\lib\site-packages\pandas\core\generic.py", line 5632, in stat_func
numeric_only=numeric_only)
File "C:\Users\user\Anaconda3\lib\site-packages\pandas\core\frame.py", line 4930, in _reduce
axis = self._get_axis_number(axis)
File "C:\Users\user\Anaconda3\lib\site-packages\pandas\core\generic.py", line 328, in _get_axis_number
axis = self._AXIS_ALIASES.get(axis, axis)
TypeError: unhashable type: 'list'