Bug 498982

Summary: When importing a CSV file, columns can get erroneously converted to int if they start with a long string of zeroes, leading to data loss.
Product: [Applications] LabPlot2 Reporter: Kat Pavlu <realkpavel>
Component: frontendAssignee: Alexander Semke <alexander.semke>
Status: RESOLVED DUPLICATE    
Severity: minor    
Priority: NOR    
Version First Reported In: latest   
Target Milestone: ---   
Platform: Flatpak   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Kat Pavlu 2025-01-21 22:48:44 UTC
SUMMARY

When importing a CSV file, columns can get erroneously converted to int if they start with a long string of whole number entries, leading to data loss.

STEPS TO REPRODUCE
1. create a CSV file. One of the columns has "0" in it for the first 2000 lines, followed by 2000 lines containing "0.3".
2. import the CSV into LabPlot2

OBSERVED RESULT
The column that starts with a long list of "0" is imported as an "Integer", which rounds all its entries to a whole number. Since the rest of the column contains values smaller than 1, all entries are lost.

EXPECTED RESULT
Option 1: The software detects the non-zero entries and selects a Double datatype.
Option 2: The user can override the automatic assignment of "Integer" in the custom filter options.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Fedora 41, using LabPlot2 from Flathub

ADDITIONAL INFORMATION
There is workaround for this issue: using a text editor, change the "0" in the first data row to "0.0".
Comment 1 Alexander Semke 2025-01-22 07:36:34 UTC

*** This bug has been marked as a duplicate of bug 498595 ***
Comment 2 Alexander Semke 2025-01-22 07:37:36 UTC
(In reply to realkpavel from comment #0)
> SUMMARY
> 
> When importing a CSV file, columns can get erroneously converted to int if
> they start with a long string of whole number entries, leading to data loss.
> 
> STEPS TO REPRODUCE
> 1. create a CSV file. One of the columns has "0" in it for the first 2000
> lines, followed by 2000 lines containing "0.3".
> 2. import the CSV into LabPlot2
> 
> OBSERVED RESULT
> The column that starts with a long list of "0" is imported as an "Integer",
> which rounds all its entries to a whole number. Since the rest of the column
> contains values smaller than 1, all entries are lost.
> 
> EXPECTED RESULT
> Option 1: The software detects the non-zero entries and selects a Double
> datatype.
> Option 2: The user can override the automatic assignment of "Integer" in the
> custom filter options.

We addressed this recently, please check the last comment in bug 498595.