Docsity

Introdução ao Numpy e Pandas, Manuais, Projetos, Pesquisas de Programação Assembly

Pré-visualização parcial do texto

Baixe Introdução ao Numpy e Pandas e outras Manuais, Projetos, Pesquisas em PDF para Programação Assembly, somente na Docsity!

Introduction to NumPy: Takeaways & by Dataquest Labs, Inc. - All rights reserved & 2019 Syntax SELECTING ROWS, COLUMNS, AND ITEMS FROM AN NDARRAY * Convert a list of lists into a ndarray: import numpy as np £ = open("nyc taxis.csv", "r") taxi list = list(csv.reader(f)) taxi = np.array(converted taxi list) * Selecting a row from an ndarray: second row = taxi[1] * Selecting multiple rows from an ndarray: all but first row = taxi[1:] * Selecting a specific item from an ndarray: fifth row second colum = taxi[4,1] SLICING VALUES FROM AN NDARRAY * Selecting a single column: second column = taxi[:,1] * Selecting multiple columns: second third colums = taxi[:,1:3] cols = [1,3,5] second fourth sixth columns = taxi[:, cols] * Selecting a 2D slice: twod slice = taxi[1:4, :3]