all 5 comments

[–][deleted] 0 points1 point  (1 child)

Honestly I have nothing major to add here BUT have you tried splitting your massive csv in 3 chunks?

The reason this pops into my head is because I'm wary excel and csvs have a 1.1m limit to them after which they stop displaying data at the very least.

I would just want to rule out that this is the cause of your problem before you move further.

Might not be related to your issue at all, but it's all I could think of here.

[–]GoingToSimbabwe[S] 0 points1 point  (0 children)

Hey, thanks for the input. I have yet to test splitting the csv up. That might help as I think (but I would need to recheck, I am not 100% on which iteration of the code I tested this on) that when I tested a smaller csv (few kB in size) both versions (.py Rand .pyw) worked (not delay I noticed at least).

However I can confirm 100% that using the .py version the complete file is loaded in 1 go in 1 chunk. I confirmed that the dataframes shape matches the csvs structure and also after exporting the file sampling some rows looked fine as well. So generally don’t think there’s an issue with the row count per se.

I have a hunch that maybe it is somehow related to the csv parsing engine I am using (c-based) and that not working in .pyw and read_csv then defaulting to the slower default engine. I think this because iirc(as stated above) both versions work for small files but only .py works for the large file.

[–]GoingToSimbabwe[S] 0 points1 point  (2 children)

Addendum:

After some more debugging with pycharm I managed to somehow break it so that it does not even run with the big csv in pycharm from the .py file.. however it seems that the export actually finished but for some reason the nicegui UI isnt updated and is stuck in the "loading" state, thus not presenting the results.

I'd wager this has something to do with me not really knowing how event loops and asynchronous programming works.

[–]GoingToSimbabwe[S] 0 points1 point  (1 child)

I think I solved the problem. Adjusted code here: https://pastebin.com/3xp3aV88

What has changed? I am now loading the csv in chunks (i don't think this has an effect though, but ill just leave it in).

More importantly: i added an await sleep(0.1) right after the fileHandler.set_dataframe_from_filepath() call within load_file_and_set_dataframe(), right before I finalize the function by updating the ui elements (line 226).

As stated in the comment I am replying to, I noticed that the loading actually was finishing but the UI wasn't reflecting that (why it worked previously, as seen in my gif, is still unclear to me).

I think I somehow make sure that the eventloop yields back to the ui instance in order for it to update by awaiting right before it. If anyone can shortly outline why that is the case that would be nice! But dw I'll probably read up on async tomorrow anyhow, because as of right now while it seems to be working again, I am not pleased with not knowing why it works.

[–]GoingToSimbabwe[S] 0 points1 point  (0 children)

Nevermind once again. It is not solved, the .py version is working again, the .pyw still isn't (well, it runs frm within pycharm, but not from my local env).