Uploading multiple csv's

Hi,

For a calculation I would like to upload three CSV and do some feature engineering seperately for each csv. I can select multiple csv’s, but how do I treat them seperately?
After having 3 dict’s I would like to join them to create one file.

Thanks!

Hi Bart,

Can you elaborate a bit more on what you want to achieve? Do the csv’s have similar columns and only different values or do they contain completely different data?

Of course, I’ll try to explain what I would like to do. The three CSV’s have different colums and sizes. The user will have this seperate sheets and I would like to join/merge the tables on the couple of columns that are similar. After that I will run some calculations on the that combined table which the user can download with the results.
Another question I have on that is how to parse dicts from one function to another in order to perform calculations and then parsing the data to a PlotlyView.

Thanks!

Bart

Thank you.

I think it makes the most sense to make 3 separate child entity types for the files. You could select them in the parent with a ChildEntityOptionField (User input, fields and buttons - Entity selection | VIKTOR Documentation). Subsequently, you can get the selected Entity objects returned in the params. You can call get_file() on the Entity object to get the File object with the file content of each csv.

The easiest way to manipulate the csv files is probably by loading them into a Pandas dataframe. You can recombine dataframes quite easily.

An explanation of the call flow of VIKTOR apps can be found here: Fundamentals - Call flow | VIKTOR Documentation. After a trigger (change in input, click of update button) the view method on the Controller is executed. If you for example have two views that use similar logic, e.g. download file content of a selected Entity, do some processing and return a dictionary, but you use the dict to create two different results I would suggest to create a separate function that you can (re)use in the two methods on the controller.

Hi Raoul,

Thanks for the suggestion. I think I get it :slight_smile: I’ll let you know if this is the solution for me.

Regards,

Bart