Spaces:
Runtime error
Runtime error
fix filtering dataframes, fix citation generator
Browse files
filter_dataframe.py
CHANGED
|
@@ -72,10 +72,14 @@ def filter_dataframe(df: pd.DataFrame, numeric_as_categorical: bool = True) -> p
|
|
| 72 |
if is_integer_dtype(df[column]):
|
| 73 |
_min = int(df[column].min())
|
| 74 |
_max = int(df[column].max())
|
|
|
|
|
|
|
| 75 |
step = 1
|
| 76 |
else:
|
| 77 |
_min = float(df[column].min())
|
| 78 |
_max = float(df[column].max())
|
|
|
|
|
|
|
| 79 |
step = (_max - _min) / 100
|
| 80 |
user_num_input = right.slider(
|
| 81 |
f"Values for {column}",
|
|
|
|
| 72 |
if is_integer_dtype(df[column]):
|
| 73 |
_min = int(df[column].min())
|
| 74 |
_max = int(df[column].max())
|
| 75 |
+
if _min == _max:
|
| 76 |
+
_max += 1
|
| 77 |
step = 1
|
| 78 |
else:
|
| 79 |
_min = float(df[column].min())
|
| 80 |
_max = float(df[column].max())
|
| 81 |
+
if _min == _max:
|
| 82 |
+
_max += 0.1
|
| 83 |
step = (_max - _min) / 100
|
| 84 |
user_num_input = right.slider(
|
| 85 |
f"Values for {column}",
|
pages/2_Dataset_Statistics_&_citation_export.py
CHANGED
|
@@ -22,8 +22,8 @@ _MMS_CITATION = """\
|
|
| 22 |
CITATION_SEPARATOR = "% " + ("-" * 90) + "\n\n"
|
| 23 |
|
| 24 |
def export_citations(df: pd.DataFrame):
|
| 25 |
-
dataset_names = df.
|
| 26 |
-
dataset_citations = df.
|
| 27 |
|
| 28 |
df = pd.DataFrame({"dataset": dataset_names, "citation": dataset_citations})
|
| 29 |
citations_grouped_df = df.groupby("citation").agg({"dataset": lambda x: ", ".join(x)}).reset_index().sort_values(by="dataset")
|
|
|
|
| 22 |
CITATION_SEPARATOR = "% " + ("-" * 90) + "\n\n"
|
| 23 |
|
| 24 |
def export_citations(df: pd.DataFrame):
|
| 25 |
+
dataset_names = df["Original Dataset"].tolist()
|
| 26 |
+
dataset_citations = df["Citation"].tolist()
|
| 27 |
|
| 28 |
df = pd.DataFrame({"dataset": dataset_names, "citation": dataset_citations})
|
| 29 |
citations_grouped_df = df.groupby("citation").agg({"dataset": lambda x: ", ".join(x)}).reset_index().sort_values(by="dataset")
|