Created
July 11, 2019 05:55
-
-
Save harpiechoise/6f170739f28920cb584feceab5ca3df7 to your computer and use it in GitHub Desktop.
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 | |
# Concatenacion | |
a = pd.DataFrame({'Numero': [60, 30], | |
'Animal': ['Panda', 'Leon']}) | |
b = pd.DataFrame({'Peso': [600, 120], | |
'Patas': [4, 4]}) | |
# Concatenar en filas | |
c = pd.concat([a, b], axis=0) # Concatenar en el eje de las filas | |
print(c) | |
# Ignorar indice | |
c = pd.concat([a, b], axis=0, ignore_index=True) | |
print(c) | |
# Concatenacion en columnas | |
c = pd.concat([a, b], axis=1) | |
print(c) | |
# Merging | |
a = pd.DataFrame({'Ciudad': ['Santiago', 'La serena', 'Temuco'], | |
'Viento KM': [30, 60, 20]}) | |
b = pd.DataFrame({'Ciudad': ['Santiago', 'La serena', 'Temuco'], | |
'Humedad': [60, 20, 30], | |
'Direccion Viento': ['E', 'S', 'O']}) | |
c = pd.merge(a, b, on='Ciudad') | |
c = pd.concat([a, b], axis=1, join='inner') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment