Added Pandas Kurtosis & Pandas Skew nodes. Fixed docstrings for various nodes to address doc inaccuracies from v1.1.0 changes.
This commit is contained in:
@@ -47,6 +47,7 @@ from .modules.pandas_wrapper.pandas_index import PandasIndex
|
||||
from .modules.pandas_wrapper.pandas_index_to_string import PandasIndexToString
|
||||
from .modules.pandas_wrapper.pandas_isna import PandasIsNA
|
||||
from .modules.pandas_wrapper.pandas_join import PandasJoin
|
||||
from .modules.pandas_wrapper.pandas_kurtosis import PandasKurtosis
|
||||
from .modules.pandas_wrapper.pandas_load_csv import PandasLoadCSV
|
||||
from .modules.pandas_wrapper.pandas_load_csv_with_encoding import PandasLoadCSVWithEncoding
|
||||
from .modules.pandas_wrapper.pandas_load_csv_with_index import PandasLoadCSVWithIndex
|
||||
@@ -83,6 +84,7 @@ from .modules.pandas_wrapper.pandas_show_index import PandasShowIndex
|
||||
from .modules.pandas_wrapper.pandas_show_series import PandasShowSeries
|
||||
from .modules.pandas_wrapper.pandas_show_text import PandasShowText
|
||||
from .modules.pandas_wrapper.pandas_sin import PandasSin
|
||||
from .modules.pandas_wrapper.pandas_skew import PandasSkew
|
||||
from .modules.pandas_wrapper.pandas_sort import PandasSort
|
||||
from .modules.pandas_wrapper.pandas_std import PandasStd
|
||||
from .modules.pandas_wrapper.pandas_sub import PandasSub
|
||||
@@ -154,6 +156,7 @@ NODE_CLASS_MAPPINGS: Dict[str, Type[T]] = {
|
||||
"PandasIndexToString": PandasIndexToString,
|
||||
"PandasIsNA": PandasIsNA,
|
||||
"PandasJoin": PandasJoin,
|
||||
"PandasKurtosis": PandasKurtosis,
|
||||
"PandasLoadCSV": PandasLoadCSV,
|
||||
"PandasLoadCSVWithEncoding": PandasLoadCSVWithEncoding,
|
||||
"PandasLoadCSVWithIndex": PandasLoadCSVWithIndex,
|
||||
@@ -190,6 +193,7 @@ NODE_CLASS_MAPPINGS: Dict[str, Type[T]] = {
|
||||
"PandasShowSeries": PandasShowSeries,
|
||||
"PandasShowText": PandasShowText,
|
||||
"PandasSin": PandasSin,
|
||||
"PandasSkew": PandasSkew,
|
||||
"PandasSort": PandasSort,
|
||||
"PandasStd": PandasStd,
|
||||
"PandasSub": PandasSub,
|
||||
@@ -261,6 +265,7 @@ NODE_DISPLAY_NAME_MAPPINGS: Dict[str, str] = {
|
||||
"PandasIndexToString": "Pandas Index To String",
|
||||
"PandasIsNA": "Pandas Is NA",
|
||||
"PandasJoin": "Pandas Join",
|
||||
"PandasKurtosis": "Pandas Kurtosis",
|
||||
"PandasLoadCSV": "Pandas Load CSV",
|
||||
"PandasLoadCSVWithEncoding": "Pandas Load CSV With Encoding",
|
||||
"PandasLoadCSVWithIndex": "Pandas Load CSV With Index",
|
||||
@@ -297,6 +302,7 @@ NODE_DISPLAY_NAME_MAPPINGS: Dict[str, str] = {
|
||||
"PandasShowSeries": "Pandas Show Series",
|
||||
"PandasShowText": "Pandas Show Text",
|
||||
"PandasSin": "Pandas Sin",
|
||||
"PandasSkew": "Pandas Skew",
|
||||
"PandasSort": "Pandas Sort",
|
||||
"PandasStd": "Pandas Std",
|
||||
"PandasSub": "Pandas Sub",
|
||||
|
||||
@@ -114,11 +114,13 @@
|
||||
| [Pandas Corr](pandas_corr.md) | Computes the correlation of the DataFrame. You can select from the Pearson, Kendall or Spearman methods. |
|
||||
| [Pandas Count](pandas_count.md) | Computes the count of a pandas DataFrame. |
|
||||
| [Pandas Cov](pandas_cov.md) | Computes the covariance of the DataFrame. |
|
||||
| [Pandas Kurtosis](pandas_kurtosis.md) | Computes the unbiased kurtosis of the DataFrame. |
|
||||
| [Pandas Max](pandas_max.md) | Computes the max of a pandas DataFrame. |
|
||||
| [Pandas Mean](pandas_mean.md) | Computes the mean of a pandas DataFrame. |
|
||||
| [Pandas Median](pandas_median.md) | Computes the median of a pandas DataFrame. |
|
||||
| [Pandas Min](pandas_min.md) | Computes the min of a pandas DataFrame. |
|
||||
| [Pandas Mode](pandas_mode.md) | Computes the mode of a pandas DataFrame. |
|
||||
| [Pandas Skew](pandas_skew.md) | Computes the unbiased skewness of the DataFrame. |
|
||||
| [Pandas Std](pandas_std.md) | Computes the standard deviation of a pandas DataFrame. |
|
||||
| [Pandas Sum](pandas_sum.md) | Computes the sum of a pandas DataFrame. |
|
||||
| [Pandas Summary](pandas_summary.md) | Analyzes and summarizes a pandas DataFrame. |
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
# Pandas Kurtosis
|
||||
Computes the unbiased kurtosis of the DataFrame.
|
||||
|
||||
This method returns the excess kurtosis rather than the raw kurtosis.
|
||||
Excess kurtosis is calculated by subtracting 3 from the raw kurtosis,
|
||||
which offsets it relative to the kurtosis of a normal distribution.
|
||||
|
||||
## Input
|
||||
| Name | Data type |
|
||||
|---|---|
|
||||
| dataframe | DataFrame |
|
||||
| axis | |
|
||||
|
||||
## Output
|
||||
| Data type |
|
||||
|---|
|
||||
| DataFrame |
|
||||
|
||||
<HR>
|
||||
Category: Summary statistics
|
||||
|
||||
ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved.
|
||||
@@ -0,0 +1,18 @@
|
||||
# Pandas Skew
|
||||
Computes the unbiased skewness of the DataFrame.
|
||||
|
||||
## Input
|
||||
| Name | Data type |
|
||||
|---|---|
|
||||
| dataframe | DataFrame |
|
||||
| axis | |
|
||||
|
||||
## Output
|
||||
| Data type |
|
||||
|---|
|
||||
| DataFrame |
|
||||
|
||||
<HR>
|
||||
Category: Summary statistics
|
||||
|
||||
ComfyUI Data Analysis Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved.
|
||||
@@ -0,0 +1,101 @@
|
||||
A,B,C,D
|
||||
0.4967141530112327,162.92314628974793,0.6788936801741416,0.2820345725713065
|
||||
-0.13826430117118466,167.8967733861732,0.7803922631841171,0.17743954377972282
|
||||
0.6476885381006925,168.28642741736616,1.0415256215876385,0.7506147516408583
|
||||
1.5230298564080254,165.98861365389192,1.0269010260174514,0.806834739267264
|
||||
-0.23415337472333597,169.19357144166995,-0.18883468397854553,0.9905051420006733
|
||||
-0.23413695694918055,172.02025428407268,0.03108748004243861,0.4126176769114265
|
||||
1.5792128155073915,179.43092950605265,0.7575176336043299,0.37201808579278317
|
||||
0.7674347291529088,170.87288906415918,0.7568929754561045,0.7764129607419968
|
||||
-0.4694743859349521,171.28775195361382,0.757523843153024,0.34080354025301784
|
||||
0.5425600435859647,169.62777042116917,2.4263657453273604,0.9307573256035647
|
||||
-0.46341769281246226,160.4061439235048,0.7854452553465835,0.8584127518430118
|
||||
-0.46572975357025687,169.86743062275391,1.0677828200902995,0.42899402737501835
|
||||
0.24196227156603412,170.30115104970514,0.9770008817466012,0.7508710677914974
|
||||
-1.913280244657798,182.31621056242642,0.825695625652899,0.7545428740846823
|
||||
-1.7249178325130328,169.03819517609438,0.3423653776798272,0.10312386883593261
|
||||
-0.5622875292409727,171.50773671166806,0.8794846102466337,0.9025529066795667
|
||||
-1.0128311203344238,169.82644115147377,0.1135873927312141,0.5052523724478571
|
||||
0.3142473325952739,164.15660981190234,0.38159069662999556,0.8264574661077416
|
||||
-0.9080240755212109,175.71411407257511,0.2573182260854483,0.32004960103061175
|
||||
-1.4123037013352915,173.75966516343388,0.5409370696931612,0.8955232284962005
|
||||
1.465648768921554,173.95515973521523,1.6573292833367543,0.3892016787341631
|
||||
-0.22577630048653566,165.4530627260263,-0.43363259629587403,0.01083765148029836
|
||||
0.06752820468792384,177.0139715546805,0.8431300951872567,0.9053819764192637
|
||||
-1.4247481862134568,162.9907446860386,-0.3063579355948258,0.09128667678613356
|
||||
-0.5443827245251827,172.93428546900134,0.26403406710528327,0.31931363759041487
|
||||
0.11092258970986608,180.9522781290499,1.044475298483683,0.9500619670508049
|
||||
-1.1509935774223028,165.04731837434656,0.5321400095477313,0.9506071469375561
|
||||
0.37569801834567196,167.16851135198613,-0.03887238896465306,0.5734378881232861
|
||||
-0.600638689918805,170.4982568254382,0.1423481453700159,0.6318372121697993
|
||||
-0.2916937497932768,167.482621729419,0.8397988744673379,0.44844552197831977
|
||||
-0.6017066122293969,162.24668284466935,0.13481668414143166,0.29321077169806453
|
||||
1.8522781845089378,170.34281487403013,0.6082292947909874,0.32866454536991596
|
||||
-0.013497224737933921,164.68848143136947,0.5227859199519069,0.6725184560770384
|
||||
-1.0577109289559004,172.3679621531759,0.17419982619709146,0.75237452943768
|
||||
0.822544912103189,165.40287882883098,1.5719720446626628,0.7915790437258485
|
||||
-1.2208436499710222,177.7496720250877,0.8169595111590056,0.7896181427945539
|
||||
0.2088635950047554,166.08373353831882,-0.5125712933288036,0.09120610304869037
|
||||
-1.9596701238797756,168.38969241897163,0.5932271573847139,0.49442030470258147
|
||||
-1.3281860488984305,174.06758608684834,0.169106767615806,0.057558760016644284
|
||||
0.19686123586912352,163.84567841783021,0.926216667398112,0.5495288823237355
|
||||
0.7384665799954104,171.13729967302064,0.10373963078364967,0.441530501373377
|
||||
0.1713682811899705,176.53571377141213,0.4426317792665505,0.8877041827582998
|
||||
-0.11564828238824053,161.96258382719387,0.7524936394902286,0.3509150125520787
|
||||
-0.3011036955892888,170.92316929266153,0.9328775970850607,0.11706701642760586
|
||||
-1.4785219903674274,171.29941397124213,-0.10014820352788811,0.14299168205283586
|
||||
-0.7198442083947086,173.90911435888654,0.3327493820795258,0.7615106317174722
|
||||
-0.4606387709597875,163.8152464456096,0.2625273444195219,0.6182180633162611
|
||||
1.0571222262189157,163.39771693457863,0.17333538371314405,0.10112267612279024
|
||||
0.3436182895684614,172.60970782808448,1.3827271201405484,0.08410680611499743
|
||||
-1.763040155362734,171.48492336616593,0.7024908554804777,0.70096913145912
|
||||
0.324083969394795,171.25246425172938,-0.1304419771675226,0.07276300636419353
|
||||
-0.38508228041631654,171.73224104748488,0.9589309735273881,0.8218600592903562
|
||||
-0.6769220003059587,166.59987639210755,1.5610780985063166,0.7062422271564962
|
||||
0.6116762888408679,171.161268485805,1.0162326302755735,0.08134878064189976
|
||||
1.030999522495951,171.4653623664934,-0.2596849829770067,0.08483771408519192
|
||||
0.9312801191161986,166.42824290986817,0.25788296356687435,0.9866395785011755
|
||||
-0.8392175232226385,179.3288725557238,1.1334555745933113,0.3742707957561203
|
||||
-0.3092123758512146,172.36916460455893,0.14616526719060963,0.3706421470668909
|
||||
0.33126343140356396,164.04348251398676,0.7219097140731142,0.8127995672575026
|
||||
0.9755451271223592,173.28276804316914,0.8873170267146684,0.9472485773838587
|
||||
-0.47917423784528995,165.12659164886338,0.036534764210958526,0.9860010638228709
|
||||
-0.18565897666381712,173.93542301871227,0.47023732196909995,0.7533781852589416
|
||||
-1.1063349740060282,175.792977895037,-1.1206336700345363,0.37625958553091576
|
||||
-1.1962066240806708,165.89658840824146,-0.012193820667144917,0.08350071669866876
|
||||
0.812525822394198,174.81688064622162,0.3737159243034198,0.7771469159274368
|
||||
1.356240028570823,172.0639046346825,-0.12389159098242475,0.558404249735805
|
||||
-0.07201012158033385,174.11030079997244,1.3162056519658176,0.4242220092469763
|
||||
1.0035328978920242,179.48396491326974,-0.21507068898031634,0.906354385094736
|
||||
0.36163602504763415,168.77305941998566,0.27997775665150815,0.11119748230615134
|
||||
-0.6451197546051243,166.23131917821254,0.5653702886430456,0.49262510429085915
|
||||
0.36139560550841393,165.55242785187238,1.2206366445330579,0.011353644767419069
|
||||
1.5380365664659692,165.92094857517282,-0.2179310755897197,0.46866064199412627
|
||||
-0.03582603910995154,169.61449145292949,1.0815818760774798,0.05630327568183735
|
||||
1.5646436558140062,171.7057598740832,0.5051165305097935,0.11881791626807192
|
||||
-2.6197451040897444,171.3834539966501,0.009245674476024535,0.11752624677710488
|
||||
0.8219025043752238,174.1359162451801,0.7310517371316354,0.6492103021160636
|
||||
0.08704706823817122,170.06500945938953,0.599529847786735,0.7460448792654233
|
||||
-0.29900735046586746,177.26767038578657,0.19989156142060266,0.5833687650971596
|
||||
0.0917607765355023,168.67671583381022,0.5349010424950095,0.9621725484745419
|
||||
-1.9875689146008928,183.6008458329481,0.3073432015691199,0.37487057952370406
|
||||
-0.21967188783751193,173.12833673882503,0.5567586726256241,0.28571208628186073
|
||||
0.3571125715117464,165.7142122179186,0.8310653372605233,0.8685991281894603
|
||||
1.477894044741516,164.64553750969444,1.293008408072676,0.22359583851945264
|
||||
-0.5182702182736474,172.4123620762159,-0.11890774941342452,0.9632225394406113
|
||||
-0.8084936028931876,168.88268607337073,1.5665166873281333,0.012154474689816341
|
||||
-0.5017570435845365,173.57000247046045,-0.47604389976125094,0.969878826707639
|
||||
0.9154021177020741,172.36618812286773,0.4241074524822083,0.04315991195057611
|
||||
0.32875110965968446,169.63585543671564,0.7941586032422883,0.8911431136980711
|
||||
-0.5297602037670388,165.76603140965798,0.6404959338675164,0.5277011090862999
|
||||
0.5132674331133561,162.42576387657067,0.1886502400897031,0.9929647961193003
|
||||
0.09707754934804039,167.7674252396649,0.39593887482136236,0.07379656473539886
|
||||
0.9686449905328892,174.28199397161737,0.25349953267058356,0.5538542844013208
|
||||
-0.7020530938773524,171.070468720651,0.20531762152789423,0.969302535619099
|
||||
-0.3276621465977682,163.77130610644005,0.9248010485105123,0.5230978441701488
|
||||
-0.39210815313215763,170.8659046292559,0.6785077429825237,0.6293986381352625
|
||||
-1.4635149481321186,171.9265868986442,0.1535452023696729,0.6957486889846172
|
||||
0.29612027706457605,165.58071281899433,0.9497999377166253,0.45454106476777323
|
||||
0.26105527217988933,170.76862552972764,0.6536497604383047,0.6275580800840634
|
||||
0.00511345664246089,170.29104359223,0.90643105941948,0.5843143119231002
|
||||
-0.23458713337514692,164.28514851084688,0.8148144209618061,0.901158010490989
|
||||
|
@@ -30,13 +30,13 @@ class PandasCreate:
|
||||
|
||||
def create(self, data: str) -> tuple:
|
||||
"""
|
||||
Create a pandas DataFrame using values entered in the text field and converts it to a JSON string.
|
||||
Create a pandas DataFrame using values entered in the text field and converts it to a DataFrame.
|
||||
|
||||
Args:
|
||||
data (str): String value in the text field.
|
||||
|
||||
Returns:
|
||||
tuple: A tuple containing a JSON string representation of the DataFrame.
|
||||
tuple: A tuple containing a the DataFrame.
|
||||
"""
|
||||
# Read CSV file into DataFrame
|
||||
df = pd.read_csv(StringIO(data))
|
||||
|
||||
@@ -31,7 +31,7 @@ class PandasCreateWithIndex:
|
||||
|
||||
def create(self, data: str, index_col: int=0) -> tuple:
|
||||
"""
|
||||
Create a pandas DataFrame using values entered in the text field and converts it to a JSON string.
|
||||
Create a pandas DataFrame using values entered in the text field and converts it to a DataFrame.
|
||||
Input data is assume to have an index.
|
||||
|
||||
Args:
|
||||
@@ -39,7 +39,7 @@ class PandasCreateWithIndex:
|
||||
index_col (int): Position of the index column.
|
||||
|
||||
Returns:
|
||||
tuple: A tuple containing a JSON string representation of the DataFrame.
|
||||
tuple: A tuple containing the DataFrame.
|
||||
"""
|
||||
# Read CSV file into DataFrame
|
||||
df = pd.read_csv(StringIO(data), index_col=index_col)
|
||||
|
||||
@@ -37,7 +37,7 @@ class PandasCummax:
|
||||
axis (str): Specify the direction to compute: Index (row label) or column label.
|
||||
|
||||
Returns:
|
||||
tuple: A tuple containing a JSON string of the renamed DataFrame.
|
||||
tuple: A tuple containing the DataFrame.
|
||||
"""
|
||||
if axis=="index":
|
||||
df_out = dataframe.cummax(axis=0)
|
||||
|
||||
@@ -37,7 +37,7 @@ class PandasCummin:
|
||||
axis (str): Specify the direction to compute: Index (row label) or column label.
|
||||
|
||||
Returns:
|
||||
tuple: A tuple containing a JSON string of the renamed DataFrame.
|
||||
tuple: A tuple containing the DataFrame.
|
||||
"""
|
||||
if axis=="index":
|
||||
df_out = dataframe.cummin(axis=0)
|
||||
|
||||
@@ -37,7 +37,7 @@ class PandasCumprod:
|
||||
axis (str): Specify the direction to compute: Index (row label) or column label.
|
||||
|
||||
Returns:
|
||||
tuple: A tuple containing a JSON string of the renamed DataFrame.
|
||||
tuple: A tuple containing the DataFrame.
|
||||
"""
|
||||
if axis=="index":
|
||||
df_out = dataframe.cumprod(axis=0)
|
||||
|
||||
@@ -37,7 +37,7 @@ class PandasCumsum:
|
||||
axis (str): Specify the direction to compute: Index (row label) or column label.
|
||||
|
||||
Returns:
|
||||
tuple: A tuple containing a JSON string of the renamed DataFrame.
|
||||
tuple: A tuple containing the DataFrame.
|
||||
"""
|
||||
if axis=="index":
|
||||
df_out = dataframe.cumsum(axis=0)
|
||||
|
||||
@@ -44,7 +44,7 @@ class PandasGroupBy:
|
||||
aggregate_function (str): The type of aggregate function to perform.
|
||||
|
||||
Returns:
|
||||
tuple: A tuple containing a JSON string of the merged DataFrame.
|
||||
tuple: A tuple containing the merged DataFrame.
|
||||
"""
|
||||
if aggragate_function == "max":
|
||||
df_out = dataframe.groupby(column_name).max()
|
||||
|
||||
@@ -38,7 +38,7 @@ class PandasHead:
|
||||
rows (int): The number of rows to retrieve.
|
||||
|
||||
Returns:
|
||||
tuple: A tuple containing a JSON string of the resulting DataFrame.
|
||||
tuple: A tuple containing the resulting DataFrame.
|
||||
"""
|
||||
df2 = dataframe.head(rows)
|
||||
return (df2,)
|
||||
|
||||
@@ -43,8 +43,7 @@ class PandasIlocRowsDataFrame:
|
||||
row_int_pos_list_json (str): A list containing row integer positions.
|
||||
|
||||
Returns:
|
||||
tuple: A tuple containing the value of the row in string. The string is
|
||||
a JSON string containing the serialized Pandas Series object.
|
||||
tuple: A tuple containing the DataFrame.
|
||||
"""
|
||||
row_int_pos_list = json.loads(row_int_pos_list_json)
|
||||
df2 = dataframe.iloc[row_int_pos_list]
|
||||
|
||||
@@ -42,7 +42,7 @@ class PandasJoin:
|
||||
join_method (str): The type of join to perform ("inner", "left", "right", "outer").
|
||||
|
||||
Returns:
|
||||
tuple: A tuple containing a JSON string of the merged DataFrame.
|
||||
tuple: A tuple containing the merged DataFrame.
|
||||
"""
|
||||
df_out = pd.merge(left_dataframe, right_dataframe, on=on_column_name, how=join_method)
|
||||
return (df_out,)
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
from typing import Any, Dict
|
||||
import pandas as pd
|
||||
|
||||
|
||||
class PandasKurtosis:
|
||||
"""
|
||||
Computes the unbiased kurtosis of the DataFrame.
|
||||
|
||||
This method returns the excess kurtosis rather than the raw kurtosis.
|
||||
Excess kurtosis is calculated by subtracting 3 from the raw kurtosis,
|
||||
which offsets it relative to the kurtosis of a normal distribution.
|
||||
|
||||
category: Summary statistics
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls) -> Dict[str, Any]:
|
||||
"""
|
||||
Defines the input types for the function.
|
||||
|
||||
Returns:
|
||||
Dict[str, Any]: A dictionary specifying required input types.
|
||||
"""
|
||||
return {
|
||||
"required": {
|
||||
"dataframe": ("DATAFRAME", {}),
|
||||
"axis": (("index", "columns"),),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES: tuple = ("PDSERIES",)
|
||||
FUNCTION: str = "f"
|
||||
CATEGORY: str = "Data Analysis"
|
||||
|
||||
def f(self, dataframe: pd.DataFrame, axis: str) -> tuple:
|
||||
"""
|
||||
Computes the unbiased kurtosis of the DataFrame.
|
||||
|
||||
Args:
|
||||
dataframe (DataFrame): The DataFrame.
|
||||
axis (str): Specify the direction to compute: Index (row label) or column label.
|
||||
|
||||
Returns:
|
||||
tuple: A tuple containing the series.
|
||||
"""
|
||||
if axis=="index":
|
||||
series = dataframe.kurtosis(axis=0)
|
||||
elif axis=="columns":
|
||||
series = dataframe.kurtosis(axis=1)
|
||||
else:
|
||||
raise ValueError("Invalid axis. Only index or columns are supported.")
|
||||
return (series,)
|
||||
@@ -45,7 +45,7 @@ class PandasRename:
|
||||
new_label (str): The new label.
|
||||
|
||||
Returns:
|
||||
tuple: A tuple containing a JSON string of the renamed DataFrame.
|
||||
tuple: A tuple containing the DataFrame.
|
||||
"""
|
||||
if axis=="index":
|
||||
df_out = dataframe.rename(index={current_label:new_label})
|
||||
|
||||
@@ -37,7 +37,7 @@ class PandasSelectRows:
|
||||
condition (str): A string representing the condition to filter rows.
|
||||
|
||||
Returns:
|
||||
tuple: A tuple containing a JSON string of the filtered DataFrame.
|
||||
tuple: A tuple containing the filtered DataFrame.
|
||||
"""
|
||||
# Apply condition
|
||||
df2 = dataframe.query(condition)
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
from typing import Any, Dict
|
||||
import pandas as pd
|
||||
|
||||
|
||||
class PandasSkew:
|
||||
"""
|
||||
Computes the unbiased skewness of the DataFrame.
|
||||
|
||||
category: Summary statistics
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls) -> Dict[str, Any]:
|
||||
"""
|
||||
Defines the input types for the function.
|
||||
|
||||
Returns:
|
||||
Dict[str, Any]: A dictionary specifying required input types.
|
||||
"""
|
||||
return {
|
||||
"required": {
|
||||
"dataframe": ("DATAFRAME", {}),
|
||||
"axis": (("index", "columns"),),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES: tuple = ("PDSERIES",)
|
||||
FUNCTION: str = "f"
|
||||
CATEGORY: str = "Data Analysis"
|
||||
|
||||
def f(self, dataframe: pd.DataFrame, axis: str) -> tuple:
|
||||
"""
|
||||
Computes the unbiased skewness of the DataFrame.
|
||||
|
||||
Args:
|
||||
dataframe (DataFrame): The DataFrame.
|
||||
axis (str): Specify the direction to compute: Index (row label) or column label.
|
||||
|
||||
Returns:
|
||||
tuple: A tuple containing the series.
|
||||
"""
|
||||
if axis=="index":
|
||||
series = dataframe.skew(axis=0)
|
||||
elif axis=="columns":
|
||||
series = dataframe.skew(axis=1)
|
||||
else:
|
||||
raise ValueError("Invalid axis. Only index or columns are supported.")
|
||||
return (series,)
|
||||
@@ -39,7 +39,7 @@ class PandasSort:
|
||||
ascending (bool): Whether to sort in ascending order.
|
||||
|
||||
Returns:
|
||||
tuple: A tuple containing a JSON string of the sorted DataFrame.
|
||||
tuple: A tuple containing the sorted DataFrame.
|
||||
"""
|
||||
df2 = dataframe.sort_values(by=column_name, ascending=ascending)
|
||||
return (df2,)
|
||||
|
||||
@@ -34,6 +34,6 @@ class PandasTranspose:
|
||||
dataframe (DataFrame): The DataFrame.
|
||||
|
||||
Returns:
|
||||
tuple: A tuple containing a JSON string of the transposed DataFrame.
|
||||
tuple: A tuple containing the transposed DataFrame.
|
||||
"""
|
||||
return (dataframe.transpose(),)
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
[project]
|
||||
name = "data-analysis"
|
||||
description = "Data analysis custom modules for ComfyUI - Use Pandas & Matplotlib within ComfyUI"
|
||||
version = "1.1.19"
|
||||
version = "1.1.20"
|
||||
license = {file = "LICENSE"}
|
||||
|
||||
[project.urls]
|
||||
|
||||
Reference in New Issue
Block a user