I need to port some functions from C# to Python, but i can't implement next code right:
[SqlFunction(IsDeterministic = true, DataAccess = DataAccessKind.None)]
public static SqlDouble LogNormDist(double probability, double mean, double stddev)
{
LognormalDistribution lnd = new LognormalDistribution(mean,stddev);
return (SqlDouble)lnd.CDF(probability);
}
This code uses CenterSpace Nmath library.
Anyone can help me to write a right function in python, which will be similar to this code?
Sorry for my English.
UPD Actually, i don't understand which scipy.stats.lognorm.cdf attrs are simillar to C# probability, mean, stddev
If just copy existing order to python, like in answer below, i get wrong number.
Scipy has a bunch of distributions defined in the scipy.stats package
Update
Okay, it looks like Scipy's stat definitions are a little nonstandard. Here's the end of the docstring for
scipy.stats.lognormal
So maybe try
If that still doesn't work, try getting a few sample points and I'll see if I can find a working relationship.
Udpate 2
Oops, I didn't realize that the scale param is a keyword. This one should now work:
Cheers and good luck with your project!