Active Topics

 


Reply
Thread Tools
Posts: 177 | Thanked: 427 times | Joined on Sep 2017
#1
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.
 
Posts: 202 | Thanked: 385 times | Joined on Jul 2018
#2
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 ?
 

The Following 2 Users Say Thank You to levone1 For This Useful Post:
Posts: 1,038 | Thanked: 3,980 times | Joined on Nov 2010 @ USA
#3
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.
 

The Following 5 Users Say Thank You to robthebold For This Useful Post:
Posts: 177 | Thanked: 427 times | Joined on Sep 2017
#4
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
 

The Following User Says Thank You to suicidal_orange For This Useful Post:
Posts: 1,038 | Thanked: 3,980 times | Joined on Nov 2010 @ USA
#5
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.
 

The Following 2 Users Say Thank You to robthebold For This Useful Post:
Posts: 177 | Thanked: 427 times | Joined on Sep 2017
#6
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!)
 

The Following User Says Thank You to suicidal_orange For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 19:17.