+ 1
Pandas. Custom names for function values
I have this code and it returns a dataframe with name and mean marks in ascending order. p=mark_table.mean(axis=1) p=p.sort_values() Upon running, the name part has a column heading which already presented in the dataframe.but after i using the mean() there is no column name on the top of the mean values.Its just empty. My question is that can i name the mean column as we do in SQL like below?👇 Select max(nums) as maximum Thank you for your Time!
5 Réponses
+ 1
Could you show a snippet of the resulting data frame and describe where you want to add a name?
0
I want to print thee values in mean() with a custom column name.(currently blank)
0
Velme
Check the screenshot https://ibb.co/YyHpdwC
0
Try p.columns = ['name', 'custom name']
0
I guess p.columns[1] = 'custom name' should also work