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
import pandas as pd | |
# Definición diccionario: | |
diccionario = {'pares': [0, 2, 4, 6], 'impares': [1, 3, 5, 7]} | |
# Creación DataFrame: | |
df_numeros = pd.DataFrame(diccionario) | |
# Guarda datos en CSV: | |
df_numeros.to_csv('numeros.csv', header=False, index=False) |
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
import pandas as pd | |
import pymysql | |
from sqlalchemy import create_engine | |
engine = create_engine('mysql+pymysql://<user>:<password>@<host>[:<port>]/<dbname>') | |
df = pd.read_sql_query('SELECT * FROM table', engine) | |
df.head() |
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
import pandas as pd | |
df = pd.DataFrame({'uno': [1, 2, 3], 'dos': [4, 5, 6], 'tres': [7, 8, 9]}, index=['x', 'y', 'z']) | |
print(df) | |
print() | |
# Orden por índice (fila): | |
print(df.sort_index()) |
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 sqlalchemy import create_engine, MetaData, Table | |
from sqlalchemy.orm import mapper | |
from sqlalchemy.sql import select | |
class MyTable(object): | |
pass | |
# Trusted Connection |
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
import pymssql | |
import pandas as pd | |
## instance a python db connection object- same form as psycopg2/python-mysql drivers also | |
conn = pymssql.connect(server="172.0.0.1", user="howens",password="some_fake_password", port=63642) # You can lookup the port number inside SQL server. | |
## Hey Look, college data | |
stmt = "SELECT * FROM AlumniMirror..someTable" | |
# Excute Query here | |
df = pd.read_sql(stmt,conn) |
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
#import pandas and numpy | |
import pandas as pd | |
import numpy as np | |
#create dataframe with some random data | |
df = pd.DataFrame(np.random.rand(10, 2) * 10, columns=['Price', 'Qty']) | |
#add a column with random string values that would need to have dummy variables created for them | |
df['City'] = [np.random.choice(('Chicago', 'Boston', 'New York')) for i in range(df.shape[0])] |
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
# Para abrir cmder desde la carpeta del usuario (el equivalente al home del usuario), editar poniendo cd en el archivo: | |
# $CMDER_ROOT/config/user_profile.sh | |
# rsync (esta forma podría funcionar para algún comando más, es cosa de probar que no den error por las dll que pueden | |
# necesitar) | |
# Fuente: | |
# https://discourse.gohugo.io/t/rsync-deploy-and-windows-10/10137/4 | |
1) Descargar como .pkg.tar.xz la última versión del comando que se quiere agregar de http://repo.msys2.org/msys/x86_64/ | |
Por ejemplo, rsync |
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
#!/bin/sh | |
# ____ _____ ____ _____ ___ _____ ___ ____ _ _____ _____ ____ | |
# / ___| ____| _ \_ _|_ _| ___|_ _/ ___| / \|_ _| ____/ ___| | |
# | | | _| | |_) || | | || |_ | | | / _ \ | | | _| \___ \ | |
# | |___| |___| _ < | | | || _| | | |___ / ___ \| | | |___ ___) | | |
# \____|_____|_| \_\|_| |___|_| |___\____/_/ \_\_| |_____|____/ | |
# ____ _______ __ | |
# | _ \| ___\ \/ / |
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
# Iniciar un repositorio vacío en el directorio actual aunque existan archivos, estos se deben agregar enseguida con git add | |
git init | |
# Hacer una copia local de un repositorio | |
git clone nombre_url_repositorio | |
# Agregar configuración del usuario actual | |
git config --global user.email "usuario@dominio" | |
git config --global user.name "usuario" | |
# Cómo ver los valores de la configuración, por ejemplo los anteriores y los alias definidos en git |
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
# -*- coding: utf-8 -*- | |
import xlrd | |
# Open the file | |
wb = xlrd.open_workbook('test.xlsx') | |
# Get the list of the sheets name | |
sheet_list = wb.sheet_names() | |
print sheet_list |
NewerOlder