larray-project / larray

N-dimensional labelled arrays in Python
https://larray.readthedocs.io/
GNU General Public License v3.0
8 stars 6 forks source link

(issue 900): implemented Range.add_plot() and add_table() #926

Open alixdamman opened 3 years ago

alixdamman commented 3 years ago

TODO @alixdamman : add method documentation + update Tutorial

gdementen commented 3 years ago

I wonder if it wouldn't be more logical to invert position and range. In test_make_plot that would be:

sheet["B8"].make_plot("B2")

Also, the dump and make_plot calls look alien to each other. One is a method on the source, the other on the target.

sheet["B2"] = population_be.dump()
sheet["B2"].make_plot("B8")

It would be better to have similar syntaxes for both. Either:

sheet["B2"] = population_be.dump()
sheet["B8"] = population_be.plot(data="B2")  # <-- bad syntax because population_be is not really used UNLESS we make it dump the data too

or

sheet["B2"].add_table(population_be)
sheet["B8"].add_plot(data_source="B2")
gdementen commented 3 years ago

implementing add_table and add_plot could be a way to tackle #826, #900, and #967.

gdementen commented 2 years ago
review-notebook-app[bot] commented 2 years ago

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

alixdamman commented 2 years ago

Shouldn't add_table create Excel tables (potentially as an option)?

What do you mean by "Excel tables" ?

gdementen commented 2 years ago

Shouldn't add_table create Excel tables (potentially as an option)?

What do you mean by "Excel tables" ?

A data range which uses the "format as Table" Excel feature (usually with an header row and autofilters).

See: https://support.microsoft.com/en-us/office/format-an-excel-table-6789619f-c889-495c-99c2-2f971c0e2370

gdementen commented 2 years ago

to be closer to a replacement for the ExcelReport API, we could allow passing an array as the datasource and add a data_sheet (or dump_data_to or whatever it is called) argument to add_plot;

sheet["B8"].add_plot(data_source=population_be, data_sheet="data")

would be equivalent to:

datasheet = workbook[data_sheet]
pos = (datasheet.shape[0], 0)
datasheet[pos] = population_be.dump()
sheet["B8"].add_plot(data_source=datasheet[pos])
gdementen commented 2 years ago

Tentatively added to 0.34 milestone (using the assumption that I take over your code), unsure I will have time to do that.

alixdamman commented 2 years ago

Tentatively added to 0.34 milestone (using the assumption that I take over your code), unsure I will have time to do that.

OK. Please do.