Handling data with pandas ++++++++++++++++++++++++++++++++++++++++ .. _labpandas: Overview ===================================================== We can consulte the slides about pandas in the following link In this folder you will find some laboratories about database managment with pandas (a python library) the purpose not is present notebooks to deploy rather to expose some methods or functions. Dataframe structure ---------------------------------------------------------- The main object with interact with data. Laboratories ------------------------------------------------------------- The objective is that you can find how solve some problems according to keywords Load data ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #. `load url (video) `_ #. `load from local (video) `_ Change name and drop columns ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #. `Change name of columns colab `_ #. `Create and drop columns `_ Counting Missing values ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #. `Nans colab `_ Filter values ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #. `Filter lab I `_ #. `Filter lab II `_ Groupby ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #. `Bankrupt by sector `_ #. `Introduction to groupby `_ #. `Excersice using groupby `_ Dates ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #. `Intro dates `_ #. `Count transactions `_ Duplicates values ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #. `Lab duplicated `_ #. `Lab duplicated groupby `_ Summation or mean over columns or rows ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Sometimes you need calculate the mean or sum a set of columns or the values of a variable #. `Lab mean-sum `_ Replace ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #. `Replace values `_ Merge and append dataframes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #. `Basic merge `_ #. `Loop-merge `_ #. `Variables consistency `_ Imputation values ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #. `Basic imputation `_ Practical laboratories ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The following laboratory is to review some concepts with practical results, to realize this lab dowloand the database `pibs-dptos.xlsx` avaliable `(Click here) `_ #. `Health lab `_ #. `Gdps lab I `_ #. `Gdps lab II `_ #. `World bank data `_ #. `TMR lab `_ #. `Hanushek lab `_ Regular expressions (Regex) ------------------------------------------------------------------------------------------ This topic deserve "apartado" given its importance. "Al principio" regex could be messy, but with practice each time its implementation is more inutitive. Regex lab ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ `regex basic `_ Laboratories I ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * `Contigency Table `_ Reshaping data ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * `Reshape data `_ * `Pivot data `_ Table one ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #. `Table one bankrupt `_ Visualization ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * `Introduction to matplolib `_ Hands-on Pandas workshop ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * `Taller 1 `_ * `Taller 2 `_ * `Taller 3 `_ * `Taller 4 `_ * `Taller 5 `_ * `Taller 6 `_ Solutions Pandas workshop ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * `Taller 1 `_ * `Taller 2 `_ * `Taller 3 `_ * `Taller 4 `_ * `Taller 5 `_ * `Taller 6 `_