Avaiga / taipy

Turns Data and AI algorithms into production-ready web applications in no time.
https://www.taipy.io
Apache License 2.0
10.94k stars 775 forks source link

BUG- support pandas series #1199

Closed jrobinAV closed 2 months ago

jrobinAV commented 4 months ago

Description Running mypy generates some errors:

mypy --ignore-missing-imports --implicit-optional --no-namespace-packages --exclude '(taipy/templates/|generate_pyi.py|tools)' --follow-imports skip --disable-error-code import-untyped --show-column-numbers --hide-error-context .

Some errors relate to the returned type of the _convert_data_to_dataframe method in _abstract_tabular, Union[pd.DataFrame, pd.Series].

The error is that the callers cannot accept a pd.Series type.

taipy\core\data\sql_table.py:126:13: error: 
Argument 1 to "__insert_dataframe" of "SQLTableDataNode" has incompatible type "DataFrame | Series[Any]"; expected "DataFrame"  [arg-type]
taipy\core\data\parquet.py:250:18: error: 
Incompatible types in assignment (expression has type "DataFrame | Series[Any]", variable has type "DataFrame")  [assignment]

Acceptance Criteria

SarthakNikhal commented 4 months ago

@jrobinAV I want to work in this issue. Already downloaded and exploring the code. Please let me know how I can reproduce, if possible in code

jrobinAV commented 4 months ago

Thank you for your help.

The issue is about a wrong type error generated by mypy. Running the following mypy command should show you the error (and its line) about the returned type.

mypy --ignore-missing-imports --implicit-optional --no-namespace-packages --exclude '(taipy/templates/|generate_pyi.py|tools)' --follow-imports skip --disable-error-code import-untyped --show-column-numbers --hide-error-context .

The purpose of the current ticket is first to exhibit a use case in a unit test that is failing. Once the use case is exhibited, we should understand how to fix the problem.

SarthakNikhal commented 4 months ago

@jrobinAV What is the generate_pyi file

jrobinAV commented 4 months ago

Hello @SarthakNikhal,

It is a script used to generate some pyi files during the build time. They are not used at run time. That's why we are excluding the file from the mypy command line. You should not need to look at it for working on this issue.

Thanks again for helping us.

jrobinAV commented 3 months ago

@SarthakNikhal Any news on this ticket?

github-actions[bot] commented 3 months ago

This issue has been labelled as "🥶Waiting for contributor" because it has been inactive for more than 14 days. If you would like to continue working on this issue, please add another comment or create a PR that links to this issue. If a PR has already been created which refers to this issue, then you should explicitly mention this issue in the relevant PR. Otherwise, you will be unassigned in 14 days. For more information please refer to the contributing guidelines.

github-actions[bot] commented 2 months ago

This issue has been unassigned automatically because it has been marked as "🥶Waiting for contributor" for more than 14 days with no activity.

jrobinAV commented 2 months ago

Thank you @trgiangdo For taking over this issue.