Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add extra columns for custom screener #88

Merged
merged 1 commit into from
Oct 2, 2023
Merged

Conversation

lit26
Copy link
Owner

@lit26 lit26 commented Oct 2, 2023

Description

Fix #86

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Code styling or code optimize

What you did

@lit26 lit26 merged commit e3e36ca into master Oct 2, 2023
2 checks passed
@lit26 lit26 deleted the fix/customs-extra-columns branch October 2, 2023 19:33
@ljilekor
Copy link

ljilekor commented Oct 6, 2023

There is still an issue

The new columns where not added to NUMBER_COL in util.py

@lit26
Copy link
Owner Author

lit26 commented Oct 6, 2023

Oh, I will take a look.

@ljilekor
Copy link

ljilekor commented Oct 6, 2023

And I also suspect something is wrong with the 'Dividend' column.
Or should I say, columnS

There seems to be 2. (dollar price and %yield)
The initial dataframe created in the screener_view() from Custom.py
contains 'Dividend' twice!
image

But once we're in the _get_table() overview.py , the second 'Dividend', one of the new columns, is not there.

  • I pumped the resulting 'frame' in a 'new_df' DataFrame for convenience...
    new_df = pd.DataFrame(frame)
    image

Causing the
return pd.concat([df, pd.DataFrame(frame)], ignore_index=True)
to FAIL (different cols)
Reindexing only valid with uniquely valued Index objects

@ljilekor
Copy link

ljilekor commented Oct 6, 2023

This is caused by the 'info_dict' key getting overwritten (instead of added)

in screener/overview.py in the _get_table() function

frame = []
for row in rows:
    cols = row.findAll("td")[1:]
    info_dict = {}
    for i, col in enumerate(cols):
        # check if the col is number
        if i not in num_col_index:
            info_dict[table_header[i]] = col.text
        else:
            info_dict[table_header[i]] = number_covert(col.text)
    frame.append(info_dict)

table_header[i] has 'Dividend' twice.
So the 'Dividend' key is overwritten...

Ambiguity stuff... Quite an annoying bug to fix.
The quick and simple way would be

  • to rename the 2nd 'Dividend' to 'Dividend Yield' in the COLUMNS of custom.py (or the 1st, don't know by heart)
  • to handle table_header[i]=='Dividend' as a special case.

but this is just a suggestion.
Maybe there are other implications...
Never easy

@lit26
Copy link
Owner Author

lit26 commented Oct 7, 2023

Will be fixed in #91

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ENH: Extra Columns Available for Custom Table
2 participants