This small subclass of the Pandas sqlalchemy-based SQL support for reading/storing tables uses the Postgres-specific "COPY FROM" method to insert large amounts of data to the database. It is much faster that using INSERT. To acheive this, the table is created in the normal way using sqlalchemy but no data is inserted. Instead the data is saved to a temporary CSV file (using Pandas' mature CSV support) then read back to Postgres using Psychopg2 support for COPY FROM STDIN.
This file contains hidden or 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
str = '1,737,761.64' | |
str.replace(/,\s?/g, "") | |
OR | |
str.split(",").join("") |
This file contains hidden or 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
git branch -m old_branch new_branch # Rename branch locally | |
git push origin :old_branch # Delete the old branch | |
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote |
This file contains hidden or 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
# PostgreSQL. Versions 9.1 and up are supported. | |
default: &default | |
adapter: postgresql | |
encoding: unicode | |
# For details on connection pooling, see Rails configuration guide | |
# http://guides.rubyonrails.org/configuring.html#database-pooling | |
host: localhost | |
database: development | |
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> |
This file contains hidden or 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
let date = new Date('2018-06-20T15:03:22.297024'); | |
let options = { | |
weekday: 'short', | |
year: 'numeric', | |
month: 'short', | |
day: 'numeric' | |
}; | |
console.log( | |
date.toLocaleDateString('es-MX', options), |
This file contains hidden or 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
{ | |
"workbench.iconTheme": "vscode-icons", | |
"workbench.editor.enablePreview": true, | |
"html.autoClosingTags": true, | |
"html.format.preserveNewLines": true, | |
"editor.tabSize": 2, | |
"editor.snippetSuggestions": "top", | |
"workbench.colorCustomizations": { | |
"editor.fontLigatures": true, | |
"editor.selectionHighlight": true, |
This file contains hidden or 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
{ | |
"1":{ | |
"name":"Bulbasaur", | |
"attack":49, | |
"defense":49, | |
"evolveLevel":16, | |
"evolveTo":"2", | |
"type":"grass", | |
"moves":[ | |
"tackle", |
This file contains hidden or 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 sys | |
import pandas as pd | |
import pymongo | |
import json | |
def import_content(filepath): | |
mng_client = pymongo.MongoClient('localhost', 27017) |
This file contains hidden or 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
In [1]: import re | |
In [2]: tacos = "Tacos al pastor, suadero, bistec y de canasta." | |
In [3]: tacos = re.sub(r'[^a-zA-Z0-9\s]', '', tacos) | |
In [4]: tacos | |
Out[4]: 'Tacos al pastor suadero bistec y de canasta' |