One Paragraph of project description goes here
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
def dataframe_difference(df1, df2, which=None): | |
"""Find rows which are different.""" | |
comparison_df = df1.merge(df2, | |
indicator=True, | |
how='outer') | |
if which is None: | |
diff_df = comparison_df[comparison_df['_merge'] != 'both'] | |
else: | |
diff_df = comparison_df[comparison_df['_merge'] == which] | |
diff_df.to_csv('data/diff.csv') |
call plug#begin() | |
" syntax check | |
Plug 'w0rp/ale' | |
" Autocomplete | |
Plug 'ncm2/ncm2' | |
Plug 'roxma/nvim-yarp' | |
Plug 'ncm2/ncm2-path' | |
Plug 'ncm2/ncm2-jedi' | |
" Formater |
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' |
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.
#!/usr/bin/env python | |
import sys | |
import pandas as pd | |
import pymongo | |
import json | |
def import_content(filepath): | |
mng_client = pymongo.MongoClient('localhost', 27017) |
{ | |
"1":{ | |
"name":"Bulbasaur", | |
"attack":49, | |
"defense":49, | |
"evolveLevel":16, | |
"evolveTo":"2", | |
"type":"grass", | |
"moves":[ | |
"tackle", |
{ | |
"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, |