User Tools

Site Tools


python:pandas

This is an old revision of the document!


Table of Contents

Pandas

Refers to Panel Data, and Python Data Analysis.

Fundamental concepts are pd.DataFrame and pd.Series

Always imported as pd: import pandas as pd

Tightly coupled to numpy.

DataFrame

A DataFrame is like a table, where each row is a Series. A DataFrame identify each row with an index, which defaults to 0..n. Same with the columns.

Indexing

import pandas as pd
 
tabledata = {'name'    :['George', 'Frank', 'John'],\
             'surname' :['Jungle', 'Sinatra', 'Wick',\
             'mail'    :['jg@jg.com', 'fs@gmail.com', 'wick@burnt.co.uk']}
 
df = pd.DataFrame(tabledata)

inplace

Most operations (?) creates a new dataset unless the property inplace=true in function calls.

df.set_index('mail', inplace=True)
python/pandas.1628190543.txt.gz · Last modified: 2022/09/12 00:30 (external edit)

Except where otherwise noted, content on this wiki is licensed under the following license: CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki