What is the maximum float in Python?

For float have a look at sys.float_info: >>> import sys >>> sys.float_info sys.floatinfo(max=1.7976931348623157e+308, max_exp=1024, max_10_exp=308, min=2.2 250738585072014e-308, min_exp=-1021, min_10_exp=-307, dig=15, mant_dig=53, epsil on=2.2204460492503131e-16, radix=2, rounds=1) Specifically, sys.float_info.max: >>> sys.float_info.max 1.7976931348623157e+308 If that’s not big enough, there’s always positive infinity: >>> infinity = float(“inf”) >>> infinity inf >>> infinity / 10000 inf The long type has … Read more

Find maximum value of a column and return the corresponding row values using Pandas

Assuming df has a unique index, this gives the row with the maximum value: In [34]: df.loc[df[‘Value’].idxmax()] Out[34]: Country US Place Kansas Value 894 Name: 7 Note that idxmax returns index labels. So if the DataFrame has duplicates in the index, the label may not uniquely identify the row, so df.loc may return more than … Read more

Minimum and maximum date

From the spec, §15.9.1.1: A Date object contains a Number indicating a particular instant in time to within a millisecond. Such a Number is called a time value. A time value may also be NaN, indicating that the Date object does not represent a specific instant of time. Time is measured in ECMAScript in milliseconds … Read more

Is there a Max function in SQL Server that takes two values like Math.Max in .NET?

If you’re using SQL Server 2008 (or above), then this is the better solution: SELECT o.OrderId, (SELECT MAX(Price) FROM (VALUES (o.NegotiatedPrice),(o.SuggestedPrice)) AS AllPrices(Price)) FROM Order o All credit and votes should go to Sven’s answer to a related question, “SQL MAX of multiple columns?” I say it’s the “best answer” because: It doesn’t require complicating … Read more