Skip to content

Instantly share code, notes, and snippets.

@elmaedesistemas
Created January 9, 2020 11:47
Show Gist options
  • Save elmaedesistemas/871af92308dbbb9d8e6b0cba3017f117 to your computer and use it in GitHub Desktop.
Save elmaedesistemas/871af92308dbbb9d8e6b0cba3017f117 to your computer and use it in GitHub Desktop.
Introduction to Pandas
Display the source blob
Display the rendered blob
Raw
#Python Pandas
import pandas as pd
dataframe = pd.read_csv('personas.csv')
dataframe
dataframe.describe()
dataframe['NOMBRE']
dataframe['NOMBRE'][1]
dataframe[['NOMBRE','APELLIDOS', 'SALARIO']]
dataframe
dataframe['SALARIO'] > 30000
filter = dataframe['SALARIO'] > 30000
dataframe2 = dataframe[filter]
dataframe2
dataframe2.values
array = dataframe2.values
array
array[0,0]
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
NOMBRE APELLIDOS EDAD SALARIO
ANTONIO PEREZ GOMEZ 34 20000
LUIS RODRIGUEZ VAZQUEZ 45 45000
ROSA MARTINEZ LOPEZ 25 15000
PEDRO SILVA GONZALEZ 54 50000
MARIA DIAZ LOPEZ 40 32000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment