I want to see and customize the python defined functions; describe, skew, and kurtosis. I can't seem to find how to access these functions codes though. I am using Jupyter Lab. Thank you for any help.
Seems like you're talking about SciPy functions. Here are the definitions: describe
, skew
, kurtosis
. I found them via the SciPy documentation -- the [source]
button. You can customize them by copying the code and changing it in your own module.
SOLVED NOW; 1- I checked the notes of describe() to see exactly which file was source. Apparently there are several generic.py files, so this is important.
Fist, I saved the file before any changes as genericBACKUP.py to be safe.
Then each small change to code, I edited the notes with a simple #1, 2, 3 to confirm I was loading the version of file with newest changes that I intended. Note that both terminal and jupyter needed restarting to force the newest saved file with defs to load.
1st - copy entire code of def describe and past it below itself.
2nd - add "SK" onto "def describeSK" to include skew & kurtosis.
3rd - add skew & kurtosis like this to the new def describeSK section;
def describe_numeric_1d(series):
stat_index = (
["count", "mean", "std", "min"] + formatted_percentiles + ["max", "skew", "kurt"]
)
d = (
[series.count(), series.mean(), series.std(), series.min()]
+ series.quantile(percentiles).tolist()
+ [series.max(), series.skew(), series.kurt()]
)
return pd.Series(d, index=stat_index, name=series.name)
My describeSK() output looks like this now. Perfect!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.