Built with blockbuilder.org
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create table json_test(id int primary key, foo jsonb); | |
insert into json_test values (1, '{"foo": "bar", "xyz": 123}'::jsonb), (2, '{"foo": "qaz", "xyz": 456}'::jsonb); | |
select id, foo->>'foo' as foo, foo->>'xyz' as xyz from json_test; | |
select id, x.foo, x.xyz from json_test, jsonb_to_record(foo) as x(foo text, xyz int); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pandas.tseries.offsets import Day | |
from pandas.tseries.holiday import AbstractHolidayCalendar, Holiday, Easter, EasterMonday, weekend_to_monday, nearest_workday | |
class BelgianHolidayCalendar(AbstractHolidayCalendar): | |
rules = [ | |
Holiday('Nieuwjaar', month=1, day=1, observance=weekend_to_monday), | |
EasterMonday, | |
Holiday('Dag van de Arbeid', month=5, day=1, observance=nearest_workday), | |
Holiday('O.H. Hemelvaart', month=1, day=1, offset=[Easter(), Day(39)]), | |
Holiday('Pinkstermaandag', month=1, day=1, offset=[Easter(), Day(50)]), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def diff(df1, df2, key): | |
def highlight_diff(col): | |
return ['background-color: yellow' if len(col.unique()) > 1 else '' for v in col] | |
s1 = df1.loc[key] | |
s2 = df2.loc[key] | |
return pd.DataFrame([s1, s2], index=['1', '2']).transpose().style.apply(highlight_diff, axis=1) |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os | |
root = '/mnt2/data' | |
text = """Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec venenatis viverra risus, nec lobortis urna posuere tempor. Maecenas quis risus id ex lobortis eleifend vitae ac nunc. Duis iaculis lacus at nisl egestas, sed lacinia sem porta. Aliquam lacinia leo at ultricies vestibulum. Integer quis ullamcorper libero. Proin tellus risus, feugiat id eros nec, placerat pellentesque augue. Maecenas vitae enim vel nisi consectetur aliquet a nec sem. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Suspendisse id velit diam. Etiam pharetra molestie lacinia. Cras ut diam ut nisi maximus condimentum ut eget nulla. Integer vestibulum ultrices sapien, non lacinia nisl lacinia eget. Vestibulum dapibus neque at consequat faucibus. Duis eu imperdiet sem. Ut ultricies rhoncus ligula a rhoncus. Proin in volutpat nisi.""" | |
for i1 in range(50): | |
dir1 = os.path.join(root, 'dir{}'.format(i1)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select q.*, n.uri from alf_qname q | |
left outer join alf_namespace n on n.id = q.ns_id; |