Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
packages=find_packages(where='src'),
package_dir={'': 'src'},

version='0.2.0',
version='0.2.1',

# scripts=[
# 'bin/fundamentus.csv.py',
Expand Down
5 changes: 3 additions & 2 deletions src/fundamentus/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
utils:
Utility helpers.
"""

import numpy
import requests
import requests_cache
import pandas as pd
Expand Down Expand Up @@ -76,7 +76,8 @@ def fmt_dec(val):
"""

res = val
res = res.replace( to_replace=r'[.]', value='' , regex=True )

res = res.apply(lambda value: value.replace('.', '') if value is not numpy.NAN and '%' in value else value)
res = res.replace( to_replace=r'[,]', value='.', regex=True )
# res = res.astype(float)
# res = res.astype(float) / 100
Expand Down
10 changes: 5 additions & 5 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ def test_from_pt_br_02():

###
def test_fmt_dec():
more_data = { 'col1': [ 11,21],
'col2': [ 12,22],
'col3': [ 13,23]}
b = { 'data': [ '45,56%','1.045,56%' ]}
more_data = { 'col1': [ 11,21,31],
'col2': [ 12,22,32],
'col3': [ 13,23,33]}
b = { 'data': [ '45,56%','1.045,56%', '0.14' ]}
b.update(more_data)
a = { 'data': [ '45.56%','1045.56%' ]}
a = { 'data': [ '45.56%','1045.56%', '0.14' ]}
a.update(more_data)

_before = pd.DataFrame(b)
Expand Down