Menu

Main Menu
Talk Get Daily Search

Member's Online

    User Name
    Password

    CSV viewer?

    Reply
    suicidal_orange | # 1 | 2021-02-11, 01:18 | Report

    Is there any way to view CSV files in Sailfish? Using 'open' in Nemo (the standard file manager) opens a spreadsheet but it only has the first column visible while 'view contents' shows the all of the first 10kb but without any formatting it's not nice to look at.

    Edit | Forward | Quote | Quick Reply | Thanks

     
    levone1 | # 2 | 2021-02-11, 02:37 | Report

    Don't know much about it, but would this do it - https://openrepos.net/content/kabouik/sc-im ?
    or - https://openrepos.net/content/kabouik/gnuplot ?

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following 2 Users Say Thank You to levone1 For This Useful Post:
    robthebold, suicidal_orange

     
    robthebold | # 3 | 2021-02-11, 17:05 | Report

    SFOS has python support, and python has a csv module. If you want to get your hands (a little) dirty you could adapt the examples here to do the job for you. . . . Ooh, it looks like there's higher level library, too, called "pandas".

    This script:

    Code:
    import pandas
    df = pandas.read_csv('hrdata.csv')
    print(df)
    Turns this csv file:

    Code:
    Name,Hire Date,Salary,Sick Days remaining
    Graham Chapman,03/15/14,50000.00,10
    John Cleese,06/01/15,65000.00,8
    Eric Idle,05/12/14,45000.00,10
    Terry Jones,11/01/13,70000.00,3
    Terry Gilliam,08/12/14,48000.00,7
    Michael Palin,05/23/13,66000.00,8
    Into this output:

    Code:
                 Name Hire Date   Salary  Sick Days remaining
    0  Graham Chapman  03/15/14  50000.0                   10
    1     John Cleese  06/01/15  65000.0                    8
    2       Eric Idle  05/12/14  45000.0                   10
    3     Terry Jones  11/01/13  70000.0                    3
    4   Terry Gilliam  08/12/14  48000.0                    7
    5   Michael Palin  05/23/13  66000.0                    8
    Wow, not bad for three lines of code.

    p.s. The mighty N900 had gnumeric . . . I miss that.

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following 5 Users Say Thank You to robthebold For This Useful Post:
    catbus, lal, olf, peterleinchen, suicidal_orange

     
    suicidal_orange | # 4 | 2021-02-12, 23:16 | Report

    Thanks for the answers, just trying them out.

    SC-IM looks good, except for some cells being full of ***********. I checked and the first one this happens on contains 186 characters so I think there's a limit? Shrinking the font didn't change what was displayed.

    Python also looked hopeful but the example linked for straight CSV reading gives 'invalid syntax' although (conveniently) my CSV has exactly 3 columns so it should work. I got "No module named pandas" when trying to import that and the install guide says to use Anaconda to install it but that also doesn't appear to be available on Sailfish. Any pointers would be much appreciated

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to suicidal_orange For This Useful Post:
    levone1

     
    robthebold | # 5 | 2021-02-13, 05:50 | Report

    In SFOS, you need to go with the pip install method rather than anaconda. So something like:

    HTML Code:
    pip3 install <module>
    . . . whether you do this as a regular user or as root will determine where the module gets installed. And IIRC, there are some switches that may apply to installing as user vs as root. I remember having to try more than one method to finally install python modules, and right now my Xperia X is being super unreliable hardware-wise.

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following 2 Users Say Thank You to robthebold For This Useful Post:
    olf, suicidal_orange

     
    suicidal_orange | # 6 | 2021-02-13, 11:22 | Report

    Python3 installed, still no pip3. No pip either... Thanks for the pointer, I'll have a play.

    Originally Posted by robthebold View Post
    right now my Xperia X is being super unreliable hardware-wise.
    Know that feeling, my X still thinks I'm holding a press off the screen half the time which leads to random things happening (like a smily zoomed in so far that it doesn't fit on the screen!)

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to suicidal_orange For This Useful Post:
    robthebold

     
vBulletin® Version 3.8.8
Normal Logout