Merge pull request #4211 from OpenBB-finance/hotfix/fix-4203

Fix wrongly formatted values on `stocks/fa/cash`
This commit is contained in:
James Maslek
2023-02-10 23:19:19 +00:00
committed by GitHub
8 changed files with 35 additions and 19 deletions

View File

@@ -683,7 +683,12 @@ def lambda_long_number_format(num, round_decimal=3) -> str:
return f"{num_str} {' KMBTP'[magnitude]}".strip()
if isinstance(num, int):
num = str(num)
if isinstance(num, str) and num.lstrip("-").isdigit():
if (
isinstance(num, str)
and num.lstrip("-").isdigit()
and not num.lstrip("-").startswith("0")
and not is_valid_date(num)
):
num = int(num)
num /= 1.0
magnitude = 0

View File

@@ -540,9 +540,20 @@ def clean_metrics_df(data: pd.DataFrame, num: int, mask: bool = True) -> pd.Data
# iloc will fail if number is greater than number of columns
num = min(num, data.shape[1])
data = data.iloc[:, 0:num]
if mask:
data = data.mask(data.astype(object).eq(num * ["None"])).dropna()
data = data.mask(data.astype(object).eq(num * ["0"])).dropna()
date_rows = {
"calendarYear": "%Y",
"fillingDate": "%Y-%m-%d",
"acceptedDate": "%Y-%m-%d %H:%M:%S",
}
for row, dt_type in date_rows.items():
if row in data.index:
data.loc[row] = pd.to_datetime(data.loc[row], format=dt_type)
data = data.applymap(lambda x: lambda_long_number_format(x))
clean_df_index(data)
data.columns.name = "Fiscal Date Ending"

View File

@@ -1,9 +1,9 @@
Fiscal Date Ending 2017 2018 2019 2020 2021
Reported currency USD USD USD USD USD
Cik 1.413 M 1.413 M 1.413 M 1.413 M 1.413 M
Filling date 2018-02-13 2019-02-07 2020-02-07 2021-02-09 2022-02-11
Cik 0001413329 0001413329 0001413329 0001413329 0001413329
Filling date 2018-02-13 00:00:00 2019-02-07 00:00:00 2020-02-07 00:00:00 2021-02-09 00:00:00 2022-02-11 00:00:00
Accepted date 2018-02-13 08:07:16 2019-02-07 15:09:20 2020-02-07 06:47:13 2021-02-09 16:20:37 2022-02-11 08:29:22
Calendar year 2.017 K 2.018 K 2.019 K 2.020 K 2.021 K
Calendar year 2017-01-01 00:00:00 2018-01-01 00:00:00 2019-01-01 00:00:00 2020-01-01 00:00:00 2021-01-01 00:00:00
Period FY FY FY FY FY
Cash and cash equivalents 8.447 B 6.593 B 6.861 B 7.280 B 4.496 B
Short term investments 0 0 0 0 0

View File

@@ -1,9 +1,9 @@
Fiscal Date Ending 2017 2018 2019 2020 2021
Reported currency USD USD USD USD USD
Cik 1.413 M 1.413 M 1.413 M 1.413 M 1.413 M
Filling date 2018-02-13 2019-02-07 2020-02-07 2021-02-09 2022-02-11
Cik 0001413329 0001413329 0001413329 0001413329 0001413329
Filling date 2018-02-13 00:00:00 2019-02-07 00:00:00 2020-02-07 00:00:00 2021-02-09 00:00:00 2022-02-11 00:00:00
Accepted date 2018-02-13 08:07:16 2019-02-07 15:09:20 2020-02-07 06:47:13 2021-02-09 16:20:37 2022-02-11 08:29:22
Calendar year 2.017 K 2.018 K 2.019 K 2.020 K 2.021 K
Calendar year 2017-01-01 00:00:00 2018-01-01 00:00:00 2019-01-01 00:00:00 2020-01-01 00:00:00 2021-01-01 00:00:00
Period FY FY FY FY FY
Net income 6.035 B 7.911 B 7.185 B 8.056 B 9.109 B
Depreciation and amortization 875 M 989 M 964 M 981 M 998 M

View File

@@ -1,9 +1,9 @@
Fiscal Date Ending 2017 2018 2019 2020 2021
Reported currency USD USD USD USD USD
Cik 1.413 M 1.413 M 1.413 M 1.413 M 1.413 M
Filling date 2018-02-13 2019-02-07 2020-02-07 2021-02-09 2022-02-11
Cik 0001413329 0001413329 0001413329 0001413329 0001413329
Filling date 2018-02-13 00:00:00 2019-02-07 00:00:00 2020-02-07 00:00:00 2021-02-09 00:00:00 2022-02-11 00:00:00
Accepted date 2018-02-13 08:07:16 2019-02-07 15:09:20 2020-02-07 06:47:13 2021-02-09 16:20:37 2022-02-11 08:29:22
Calendar year 2.017 K 2.018 K 2.019 K 2.020 K 2.021 K
Calendar year 2017-01-01 00:00:00 2018-01-01 00:00:00 2019-01-01 00:00:00 2020-01-01 00:00:00 2021-01-01 00:00:00
Period FY FY FY FY FY
Revenue 28.748 B 29.625 B 29.805 B 28.694 B 31.405 B
Cost of revenue 10.432 B 10.758 B 10.513 B 9.569 B 10.030 B

View File

@@ -1,9 +1,9 @@
Fiscal Date Ending 2017 2018 2019 2020 2021
Reported currency USD USD USD USD USD
Cik 1.413 M 1.413 M 1.413 M 1.413 M 1.413 M
Filling date 2018-02-13 2019-02-07 2020-02-07 2021-02-09 2022-02-11
Cik 0001413329 0001413329 0001413329 0001413329 0001413329
Filling date 2018-02-13 00:00:00 2019-02-07 00:00:00 2020-02-07 00:00:00 2021-02-09 00:00:00 2022-02-11 00:00:00
Accepted date 2018-02-13 08:07:16 2019-02-07 15:09:20 2020-02-07 06:47:13 2021-02-09 16:20:37 2022-02-11 08:29:22
Calendar year 2.017 K 2.018 K 2.019 K 2.020 K 2.021 K
Calendar year 2017-01-01 00:00:00 2018-01-01 00:00:00 2019-01-01 00:00:00 2020-01-01 00:00:00 2021-01-01 00:00:00
Period FY FY FY FY FY
Cash and cash equivalents 8.447 B 6.593 B 6.861 B 7.280 B 4.496 B
Short term investments 0 0 0 0 0

View File

@@ -1,9 +1,9 @@
Fiscal Date Ending 2017 2018 2019 2020 2021
Reported currency USD USD USD USD USD
Cik 1.413 M 1.413 M 1.413 M 1.413 M 1.413 M
Filling date 2018-02-13 2019-02-07 2020-02-07 2021-02-09 2022-02-11
Cik 0001413329 0001413329 0001413329 0001413329 0001413329
Filling date 2018-02-13 00:00:00 2019-02-07 00:00:00 2020-02-07 00:00:00 2021-02-09 00:00:00 2022-02-11 00:00:00
Accepted date 2018-02-13 08:07:16 2019-02-07 15:09:20 2020-02-07 06:47:13 2021-02-09 16:20:37 2022-02-11 08:29:22
Calendar year 2.017 K 2.018 K 2.019 K 2.020 K 2.021 K
Calendar year 2017-01-01 00:00:00 2018-01-01 00:00:00 2019-01-01 00:00:00 2020-01-01 00:00:00 2021-01-01 00:00:00
Period FY FY FY FY FY
Net income 6.035 B 7.911 B 7.185 B 8.056 B 9.109 B
Depreciation and amortization 875 M 989 M 964 M 981 M 998 M

View File

@@ -1,9 +1,9 @@
Fiscal Date Ending 2017 2018 2019 2020 2021
Reported currency USD USD USD USD USD
Cik 1.413 M 1.413 M 1.413 M 1.413 M 1.413 M
Filling date 2018-02-13 2019-02-07 2020-02-07 2021-02-09 2022-02-11
Cik 0001413329 0001413329 0001413329 0001413329 0001413329
Filling date 2018-02-13 00:00:00 2019-02-07 00:00:00 2020-02-07 00:00:00 2021-02-09 00:00:00 2022-02-11 00:00:00
Accepted date 2018-02-13 08:07:16 2019-02-07 15:09:20 2020-02-07 06:47:13 2021-02-09 16:20:37 2022-02-11 08:29:22
Calendar year 2.017 K 2.018 K 2.019 K 2.020 K 2.021 K
Calendar year 2017-01-01 00:00:00 2018-01-01 00:00:00 2019-01-01 00:00:00 2020-01-01 00:00:00 2021-01-01 00:00:00
Period FY FY FY FY FY
Revenue 28.748 B 29.625 B 29.805 B 28.694 B 31.405 B
Cost of revenue 10.432 B 10.758 B 10.513 B 9.569 B 10.030 B