* Cantinho Satkeys

Refresh History
  • j.s.: dgtgtr a todos  4tj97u<z
    07 de Julho de 2025, 13:50
  • FELISCUNHA: Votos de um santo domingo para todo o auditório  4tj97u<z
    06 de Julho de 2025, 11:43
  • j.s.: [link]
    05 de Julho de 2025, 16:31
  • j.s.: dgtgtr a todos  4tj97u<z
    05 de Julho de 2025, 16:31
  • j.s.: h7t45 ao convidado de Honra batatinha pela sua ajuda
    05 de Julho de 2025, 16:30
  • FELISCUNHA: ghyt74  pessoal   4tj97u<z
    04 de Julho de 2025, 11:58
  • JPratas: dgtgtr Pessoal  101041 Vamos Todos Ajudar na Manutenção do Forum, Basta 1 Euro a Cada Um  43e5r6
    03 de Julho de 2025, 19:02
  • cereal killa: Todos os anos e preciso sempre a pedir esmolas e um simples gesto de nem que seja 1€ que fosse dividido por alguns ajudava, uma coisa e certa mesmo continuando isto vai levar volta a como se tem acesso aos tópicos, nunca se quis implementar esta ideia mas quem não contribuir e basta 1 € por ano não terá acesso a sacar nada, vamos ver desenrolar disto mais ate dia 7,finalmente um agradecimento em nome do satkeys a quem já fez a sua doação, obrigada
    03 de Julho de 2025, 15:07
  • m1957: Por favor! Uma pequena ajuda, não deixem que o fórum ecerre. Obrigado!
    03 de Julho de 2025, 01:10
  • j.s.: [link]
    02 de Julho de 2025, 21:09
  • j.s.: h7t45 ao membro anónimo pela sua ajuda  49E09B4F
    02 de Julho de 2025, 21:09
  • j.s.: dgtgtr a todos  4tj97u<z
    01 de Julho de 2025, 17:18
  • FELISCUNHA: Votos de um santo domingo para todo o auditório  4tj97u<z
    29 de Junho de 2025, 11:59
  • m1957: Foi de boa vontade!
    28 de Junho de 2025, 00:39
  • j.s.: passem f.v. por aqui [link]    h7t45
    27 de Junho de 2025, 17:20
  • j.s.: renovamos o nosso pedido para uma pequena ajuda para pagemento  do nosso forum
    27 de Junho de 2025, 17:19
  • j.s.: h7t45 aos convidados de honra Felizcunha e M1957 pela ajuda
    27 de Junho de 2025, 17:15
  • j.s.: dgtgtr a todos  4tj97u<z
    27 de Junho de 2025, 17:13
  • FELISCUNHA: ghyt74  pessoal  4tj97u<z
    27 de Junho de 2025, 11:51
  • JPratas: try65hytr A Todos  classic k7y8j0
    27 de Junho de 2025, 04:35

Autor Tópico: Working with PANDAS  (Lida 275 vezes)

0 Membros e 1 Visitante estão a ver este tópico.

Offline mitsumi

  • Sub-Administrador
  • ****
  • Mensagens: 121842
  • Karma: +0/-0
Working with PANDAS
« em: 13 de Julho de 2020, 06:03 »

Working with PANDAS
Duration: 57m | .MP4 1920x1080, 30 fps(r) | AAC, 44100 Hz, 2ch | 540 MB
Genre: eLearning | Language: English

What is Pandas
Pandas is Python's ETL package for structured data
Built on top of numpy, designed to mimic the functionality of R dataframes
Provides a convenient way to handle tabular data
Can perform all SQL functionalities, including group-by and join.
Compatible with many other Data Science packages, including visualisation packages such as MatDescriptionlib and Seaborn
Defines two main data types:
pandas.Series
pandas.DataFrame

Series
Generalised array -- can be viewed as a table with a single column
It consists of two numpy arrays:
Index array: stores the index of the elements
values array: stores the values of the elements
Each array element has an unique index (ID), contained in a separate index array
If we reorder the series, the index moves with element. So an index will always identify with the same element in the series
Indices do not have to be sequential, they do not even have to be numbers.
Think indices as the primary keys for each row in a single column table

DataFrames
A pandas DataFrame represents a table, it contains
Data in form of rows and columns
Row IDs (the index array, i.e. primary key)
Column names (ID of the columns)
A DataFrame is equivalent to collection of Series with each Series representing a column
The row indices by default start from 0 and increase by one for each subsequent row, but just like Series they can be changed to any collection of objects
Each row index uniquely identifies a particular row. If we reorder the rows, their indices go with them

Group By
Groups are usually used together with reductions
Counting number of rows in each group
my_dataframe.groupby(criteria).size()
Sum of every numerical column in each group
my_dataframe.groupby(criteria).sum()
Mean of every numerical column in each group
my_dataframe.groupby(criteria).mean()

Join
Use DataFrame.merge() as a general method of joining two dataframes:
Works also with series
Joins on the primary keys of the two dataframes (series)

Missing Values
Finding out number of missing values in each column
my_dataframe.isna().sum()
Removing rows
my_dataframe.dropna(axis = 0)
Removing columns
my_dataframe.dropna(axis = 1)
Filling with a value
For all missing values: my_dataframe.fillna(replacement_value)
Different value for each column: my_dataframe.fillna({'NAME': 'UNKNOWN', 'AGE': 0})

Map, Replace, Apply
Map applies a mapping to every element of the dataframe
my_dataframe.map({old1: new1, old2: new2, ...})
my_dataframe.map(function)
If we provide map using a dictionary, then any elements not in the keys will be mapped to numpy.nan
Replace applies a mapping to only elements of the dataframe that have been mentioned in the mapping
my_dataframe.replace ({old1: new1, old2: new2, ...})
Any elements not in the dictionary keys will not be changed

Download link:
Só visivel para registados e com resposta ao tópico.

Only visible to registered and with a reply to the topic.

Links are Interchangeable - No Password - Single Extraction