Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Make categorical_input/numerical_input optional for TabularData.from_df #108

Closed
aniketmaurya opened this issue Feb 12, 2021 · 0 comments · Fixed by #109
Closed

Make categorical_input/numerical_input optional for TabularData.from_df #108

aniketmaurya opened this issue Feb 12, 2021 · 0 comments · Fixed by #109
Labels
bug / fix Something isn't working help wanted Extra attention is needed

Comments

@aniketmaurya
Copy link
Contributor

aniketmaurya commented Feb 12, 2021

🐛 Bug

If I have only numerical features then I still have to pass an empty list for the categorical_input. It can be optional.
image

To Reproduce

Steps to reproduce the behavior:

  1. df = pd.DataFrame({'digit': [1,2,3], 'odd_even':[0,1,0]})
  2. datamodule = TabularData.from_df(df, 'odd_even',
    numerical_input=['digit'],
    )
TypeError                                 Traceback (most recent call last)
<ipython-input-122-405a8bb49976> in <module>
      1 datamodule = TabularData.from_df(final_data, 'target', 
----> 2                     numerical_input=train_x.columns.tolist(),
      3 #                     categorical_input=[],
      4                    )

TypeError: from_df() missing 1 required positional argument: 'categorical_input'

Code sample

df = pd.DataFrame({'digit': [1,2,3], 'odd_even':[0,1,0]})
datamodule = TabularData.from_df(df, 'odd_even', 
                    numerical_input=['digit'],
                   )

Expected behaviour

If only one of categorical or numerical input is passed then users should not be forced to enter an empty list.

Environment

  • PyTorch Version (e.g., 1.0): '1.7.1'
  • OS (e.g., Linux): MacOS
  • How you installed PyTorch (conda, pip, source): pip
  • Python version:Python 3.7.9

I would love to start my contribution to Flash by fixing this issue.

@aniketmaurya aniketmaurya added bug / fix Something isn't working help wanted Extra attention is needed labels Feb 12, 2021
@aniketmaurya aniketmaurya changed the title Make categorical_input/numerical_input optional Make categorical_input/numerical_input optional for TabularData.from_df Feb 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug / fix Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant