Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/env python
""" This script requires Pendulum https://pendulum.eustace.io which may need
installation through pip.
R. Biswas (@rbiswas4).
"""
from datetime import datetime
import pytz
from datetime import tzinfo
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# sqlite has no function like std or var. This is a method of how it can be calculated
# assume we want to get the variance of the column fieldRA from the table Summary in a sqlite DB. In this case the following produces the variance
SELECT avg((SUMMARY.fieldRA - sub.a)*(SUMMARY.fieldRA - sub.a)) FROM Summary, (SELECT avg(fieldRA) as a FROM SUMMARY) AS sub;

Colons can be used to align columns.

Tables Are Cool
col 3 is right-aligned $1600
col 2 is centered $12
zebra stripes are neat $1

There must be at least 3 dashes separating each header cell. The outer pipes (|) are optional, and you don't need to make the

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
We can make this file beautiful and searchable if this error is corrected: It looks like row 6 should actually have 23 columns, instead of 14 in line 5.
name,Unnamed: 0,zcmb,zhel,mb,sig_mb,x1,sig_x1,c,sig_c,log_stm,sig_log_stm,tmax,sig_tmax,covmbs,covmbc,covsc,set,RAJ2000,DECJ2000,bias,survey,SimbadName
03D1au,0,0.503,0.5043,23.002,0.08800000000000001,1.273,0.15,-0.012,0.03,9.517,0.11,52909.745,0.214,0.00079,0.00044,-3e-05,1,36.04321,-4.0374690000000015,0.002,SNLS,03D1au.1
03D1aw,1,0.581,0.5820000000000001,23.574,0.09,0.974,0.274,-0.025,0.037000000000000005,9.169,0.08800000000000001,52902.898,0.353,0.00282,0.00041,0.00157,1,36.06163400000001,-4.517158,0.001,SNLS,03D1aw
03D1ax,2,0.495,0.496,22.96,0.08800000000000001,-0.7290000000000001,0.102,-0.1,0.03,11.58,0.112,52915.924000000006,0.112,0.00054,0.00047,-2e-05,1,36.097287,-4.720774,0.002,SNLS,03D1ax
03D1bp,3,0.34600000000000003,0.34700000000000003,22.398000000000003,0.087,-1.155,0.113,-0.041,0.027000000000000003,10.821,0.124,52920.249,0.103,0.00111,0.00062,0.00029,1,36.657235,-4.838779,0.0,SNLS,03D1bp
03D1co,4,0.6779999999999999,0.679,24.078000000000007,0.098,0.619,0.404,-0.039,0.067,8.647,0.284,52954.458,0.45
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.