Replaced the occurrence of the words 'column index' with 'column label'.

This commit is contained in:
HowToSD
2025-02-16 13:19:08 -08:00
parent 9976ae4aa4
commit 2b217ab5cb
6 changed files with 15 additions and 15 deletions
@@ -8,7 +8,7 @@ class PandasIlocRowSeries:
PandasLocRowSeries:
A class for selecting a row from a pandas DataFrame and returning it as a Series.
The row is specified by its integer position, similar to an index in other software.
Note: In Pandas, "index" refers to a unique label assigned to each row or column. See https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.iloc.html
Note: In Pandas, "index" refers to a unique label assigned to each row. See https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.iloc.html
"""
@classmethod
@@ -21,8 +21,8 @@ class PandasLocCellStr:
"dataframe_json": ("STRING", {"multiline": True}),
"row_index": ("STRING", {"default": ""}),
"row_index_type":(("string", "int"),),
"column_index": ("STRING", {"default": ""}),
"column_index_type":(("string", "int"),)
"column_label": ("STRING", {"default": ""}),
"column_label_type":(("string", "int"),)
}
}
@@ -33,8 +33,8 @@ class PandasLocCellStr:
def cell(self, dataframe_json: str,
row_index: str,
row_index_type: str,
column_index: str,
column_index_type: str) -> tuple:
column_label: str,
column_label_type: str) -> tuple:
"""
Selects specific cell from a pandas DataFrame.
@@ -42,8 +42,8 @@ class PandasLocCellStr:
dataframe_json (str): A JSON string representation of the DataFrame.
row_index (str): The row index (row label) for the cell.
row_index_type (str): The data type of the row index.
column_index (str): The column index (row label) for the cell.
column_index_type (str): The data type of the column index.
column_label (str): The column label for the cell.
column_label_type (str): The data type of the column label.
Returns:
tuple: A tuple containing the value of the cell in string.
@@ -51,7 +51,7 @@ class PandasLocCellStr:
# Deserialize JSON string to DataFrame
df = pd.read_json(StringIO(dataframe_json))
row_index = int(row_index) if row_index_type == "int" else row_index
column_index = int(column_index) if column_index_type == "int" else column_index
column_label = int(column_label) if column_label_type == "int" else column_label
value = df.loc[row_index, column_index]
value = df.loc[row_index, column_label]
return (str(value),)