Python-VLANG Data Tool
In this example, I have used a simple VLANG script and a Python script to display a dataset filtered from a SQLITE database.
VLANG has a wrapper for the SQLite library, it requires the SQLITE C source code ( at the time of writing sqlite-amalgamation-3380500.zip) which has to be located in a subdirectory named thirdparty/sqlite relative to VLANG's root directory. VLANG compiles this module with its internal Tiny C compiler.
The following script:
// filename : testvml.v
import sqlite
fn main() {
db := sqlite.connect('C:\\Users\\Seve\\workplace\\v\\examples\\database\\vsqlite.db')?
query :='select * from t_dataset LIMIT 300'
data, code := db.exec(query)
if code == 101
{
for row in data {
println(row.vals.join(', '))
}
}
else
{
println('SQL Result code: $code')
}
}
when run from the command line with :
$ v.exe run testvml.v
it outputs the result (comma separated format) of the query to the standard output.
Pandas GUI
Pandas GUI provides a detailed desktop interface for dataframe objects, it can be installed with:
$ pip install pandasgui
The python script below collects data from the standard input, creates a pandas dataframe, and opens the desktop GUI,
#!/usr/bin/env python
# filename: csvgui.py
import sys
import csv
import pickle
import pandas as pd
from pandasgui import show
data = sys.stdin.readlines()
csvdata = csv.reader(data)
try:
df = pd.DataFrame(list(csvdata),columns=['x1','x2','cat'])
except:
print("".join(data))
exit()
df = df.apply(pd.to_numeric, errors='ignore')
#print(df.describe())
df.to_pickle("last.pkl")
show(df)
as shown in this video.