Skip to content
Advertisement

Tag: max

Max and Min value for each colum of one Dataframe

Give this dataframe ‘x’: How I could get a list of pairs with the min and max of each column? The result would be: Answer You could define a function and call apply passing the function name, this will create a df with min and max as the index names: If you insist on a list of lists we can

Max function in python returning wrong results

I am trying to find the Max and Min in a set of numbers from a CSV file. My code keeps returning the wrong number for Max function for some rows. Here is my code: An example of my output: I am not sure what I have done wrong. Some advice would be appreciated. Answer Your list elements are strings.

How to find the longest word with python?

How can I use python to find the longest word from a set of words? I can find the first word like this: Answer If I understand your question correctly: split() splits the string into words (seperated by whitespace); max() finds the largest element using the builtin len() function, i.e. the string length, as the key to find out what

Advertisement