User Tools

Site Tools


python:pandas

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=True

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

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

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