Commit 137c49d9 authored by Lukas Eller's avatar Lukas Eller

Added progress bar

parent 98d233db
import pandas as pd import pandas as pd
import itertools import itertools
import numpy as np import numpy as np
from tqdm import tqdm
def link_dataframes(A: pd.DataFrame, B: pd.DataFrame, ref_col: str, metric=None) -> (pd.DataFrame, np.array): def link_dataframes(A: pd.DataFrame, B: pd.DataFrame, ref_col: str, metric=None, verbose=True) -> (pd.DataFrame, np.array):
''' '''
Merge two DataFrames A and B according to the reference colum based on minimum metric. Merge two DataFrames A and B according to the reference colum based on minimum metric.
...@@ -22,7 +23,7 @@ def link_dataframes(A: pd.DataFrame, B: pd.DataFrame, ref_col: str, metric=None) ...@@ -22,7 +23,7 @@ def link_dataframes(A: pd.DataFrame, B: pd.DataFrame, ref_col: str, metric=None)
metric = lambda a, b: (a - b).abs() metric = lambda a, b: (a - b).abs()
indices, deviations = [], [] indices, deviations = [], []
for _, element in A.iterrows(): for _, element in tqdm(A.iterrows(), total=A.shape[0], disable=(not verbose)):
distances = metric( distances = metric(
element[ref_col], element[ref_col],
B[ref_col] B[ref_col]
......
...@@ -10,7 +10,7 @@ README = (HERE / "README.md").read_text() ...@@ -10,7 +10,7 @@ README = (HERE / "README.md").read_text()
# This call to setup() does all the work # This call to setup() does all the work
setup( setup(
name="measprocess", name="measprocess",
version="0.5.3", version="0.5.4",
description="Collection of measurement processing tools", description="Collection of measurement processing tools",
long_description=README, long_description=README,
long_description_content_type="text/markdown", long_description_content_type="text/markdown",
...@@ -23,5 +23,5 @@ setup( ...@@ -23,5 +23,5 @@ setup(
], ],
packages=["measprocess"], packages=["measprocess"],
include_package_data=True, include_package_data=True,
install_requires=["pandas", "matplotlib", "geopandas", "overpy", "shapely", "numpy"], install_requires=["pandas", "matplotlib", "geopandas", "overpy", "shapely", "numpy", "tqdm"],
) )
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment