csv2sqlite | Python script to load CSV to SQLite | Database library
kandi X-RAY | csv2sqlite Summary
kandi X-RAY | csv2sqlite Summary
Script to load CSV into an SQLite database (with type guessing!).
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Convert a CSV file into a table
- Guess the type of each column
csv2sqlite Key Features
csv2sqlite Examples and Code Snippets
Community Discussions
Trending Discussions on csv2sqlite
QUESTION
In my assessment I'm asked to write a shell script using only bash commands and another shell script using only SQL queries. These scripts should do the following: 1. Clean data in the .csv file (not important at the moment) 2. Sum up earnings based upon gender 3. Produce a simple HTML table
I have made the SQL query produce the correct numbers and HTML file, but with som help from other bash commands. For the file that should only contain bash commands I'm able to get the table but one of the numbers are wrong.
I'm very new to bash scripting and SQL queries so the code isn't very optimised.
The following is a shortned version of the sample input: CSV input
...ANSWER
Answered 2019-Aug-25 at 17:17#! /bin/bash
awk -F, '{
if (NR != 1)
{
if (sum[$13] == "")
{
sum[$13]=0
}
sum[$13]+=$5
}
}
END {
print ""
print "GenderTotal Amount [$]"
for ( gender in sum )
{
print ""gender"", ""sum[gender]""
}
print ""
}' table.csv
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install csv2sqlite
You can use csv2sqlite like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page