Are you over 18 and want to see adult content?
More Annotations
![A complete backup of czechgaysolarium.com](https://www.archivebay.com/archive2/833236fa-fbc2-4262-8816-b4e442383d95.png)
A complete backup of czechgaysolarium.com
Are you over 18 and want to see adult content?
![A complete backup of zapinterlations.com](https://www.archivebay.com/archive2/debc121e-cd45-4f23-95c3-9b9da344eb3d.png)
A complete backup of zapinterlations.com
Are you over 18 and want to see adult content?
![A complete backup of bigoliveapkmod.com](https://www.archivebay.com/archive2/597e66b6-af1b-436c-889f-47dfc3d20424.png)
A complete backup of bigoliveapkmod.com
Are you over 18 and want to see adult content?
![A complete backup of queenletiziastyle.com](https://www.archivebay.com/archive2/4df180c3-7ee5-429c-8bc6-21f795241fcc.png)
A complete backup of queenletiziastyle.com
Are you over 18 and want to see adult content?
![A complete backup of smashingpumpkins.com](https://www.archivebay.com/archive2/37dd2610-15ae-4259-ac81-aacb293c68d3.png)
A complete backup of smashingpumpkins.com
Are you over 18 and want to see adult content?
![A complete backup of biologyjunction.com](https://www.archivebay.com/archive2/3b162d5f-66ac-4886-bd0a-46d34c14909d.png)
A complete backup of biologyjunction.com
Are you over 18 and want to see adult content?
Favourite Annotations
![A complete backup of www.biobiochile.cl/noticias/deportes/futbol/futbol-nacional/2020/02/29/colo-colo-jugara-este-sabado-su-prim](https://www.archivebay.com/archive2/8c1c2e49-b2d4-472c-9796-535cc296b4d3.png)
A complete backup of www.biobiochile.cl/noticias/deportes/futbol/futbol-nacional/2020/02/29/colo-colo-jugara-este-sabado-su-prim
Are you over 18 and want to see adult content?
![A complete backup of www.nieuwsblad.be/cnt/dmf20200226_04865769](https://www.archivebay.com/archive2/ade7e00d-bcf8-4b1e-b5fa-7875cb08dfd2.png)
A complete backup of www.nieuwsblad.be/cnt/dmf20200226_04865769
Are you over 18 and want to see adult content?
Text
Open-Science
* Images
Search
THE OPEN SCIENCE PROJECTFrench English
__ Identification
-------------------------__ Sign-Up
------------------------- Create a new notebook__ Contributors
------------------------- Open Science Notebooks__ Notes
------------------------- HOW TO CHANGE THE COLOR BACKGROUND OF A MATPLOTLIB FIGURE ? __ Daidalos __ November20, 2019
Examples of how to change the color background of a matplotlib figure: ### Using subplot and the option axisbg from pylab import * subplot(111, axisbg='#ababab') t = arange(0.0, 2.0, 0.01) s = sin(2*pi*t) plot(t, s) xlabel('x') ylabel('y') title('How to change background color in matplotlib ?') savefig('exemple_01.png') show() source: [How to set opacity of backgroun ... ELEMENTARY OPERATIONS ON LISTS IN PYTHON __ Daidalos __ November20, 2019
Examples of elementary operations on lists in python ### Create a list Create an empty list >>> l = >>> type(myfirstlist)20, 2019
Examples of how to sum / add two or several matrices together in python using numpy: ### Add two matrices of same size Let sum two matrices of same size. Let's consider the matrix A: >>> import numpy as np >>> A = np.array((,)) >>> A array() \begin{equation} A = \left( \begin{array}{ccc} 3 & 1 \\\\ 6 & 4 \end{array}\right) \end{equation} and matrix B: >>> B = np.array((,)) >>> B array( ... COMMENT ADDITIONNER / SOMMER DEUX OU PLUSIEURS MATRICES EN PYTHON ? __ Daidalos __ November19, 2019
Exemples de comment additionner (sommer) deux ou plusieurs matrices en python: ### Additionner deux matrices de même taille Le cas le plus simple est si deux matrices A et B ont les mêmes dimensions. Soit par exemple la matrice A suivante: >>> import numpy as np >>> A = np.array((,)) >>> A array() \begin{equation} A = \left( \begin{array}{ccc} 3 & 1 \\\\ 6 & 4 \end{array}\right) \end{equation} et la matrice B: >>> B = np ... HOW TO GET A COMPLEX NUMBER IN POLAR COORDINATES IN PYTHON ? __ Daidalos __ November16, 2019
Examples of how to get a complex number in polar coordinates in python: ### Using the python module cmath To get a complex number in polar coordinate a solution is to use the python module (https://docs.python.org/2/library/cmath.html): >>> import cmath Let's consider the following complex number: >>> z = 2 + 3j to get the polar coordinates: >>> r,theta = cmath.polar(z) >>> r 3.605551275463989 >>> theta 0.982793723247329 Note: to return the c...
COMMENT CALCULER LES COORDONNÉES POLAIRES D'UN NOMBRE COMPLEXE ENPYTHON ?
__ Daidalos __ November16, 2019
Exemples de comment calculer les coordonnées polaires d'un nombre complexe en python ### Avec le module cmath Avec python pour calculer les coordonnées polaires d'un nombre complexe , il existe le module (https://docs.python.org/2/library/cmath.html): >>> import cmath Soit le nombre complexe z suivant sous forme algébrique: >>> z = 2 + 3j avec comme coordonnées cartésiennes (2,3). Pour convertir ces coordonnées en coordonnées polaire on peut utiliser lafonc ...
HOW TO CREATE A MATRIX OF COMPLEX NUMBERS IN PYTHON USING NUMPY ? __ Daidalos __ November15, 2019
Examples of how to create a matrix of complex numbers in python using numpy: ### Create a matrix of random numbers >>> Z = np.array() >>> Z array() ### Create a matrix of random numbers with 0+0j >>> import numpy as np >>> Z = np.zeros(10, dtype=complex) >>> Z array([ 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j,0.+0.j, 0.+0. ...
HOW TO GET THE CONJUGATE OF A COMPLEX NUMBER IN PYTHON ? __ Daidalos __ November15, 2019
Examples of how to get the conjugate of a complex number z in python: ### Get the conjugate of a complex number A solution is to usethe python function
(http://stackoverflow.com/questions/8370637/complex-numbers-usage-in-python), example >>> z = complex(2,5) >>> z.conjugate() (2-5j) >>> ### Matrix of complex numbers Another example using a matrix of complex numbers import numpy as np >>> Z = np.random.random(10) + np.random. ... HOW TO EXTRACT THE REAL AND IMAGINARY PARTS OF A COMPLEX NUMBER INPYTHON ?
__ Daidalos __ November15, 2019
To extract the the real and imaginary parts of a complex number z=a+ib in python, a solution is to use z.real and z.imag: ### Extract the real and imaginary parts of a complex number >>> z = complex(2,5) >>> z (2+5j) >>> z.real 2.0 >>> z.imag 5.0 ### Matrix of complex number It also works with matrix of complex numbers: >>> import numpy as np >>> Z = np.array() >>> Z array([, [ 5.+6. ... HOW TO GET THE MODULUS OF COMPLEX NUMBER IN PYTHON ? __ Daidalos __ November15, 2019
Examples of how to get the modulus of complex number in python: ### Definition The modulus of complex number $z=a+ib$ is: \begin{equation} |z| = |a+ib| = \sqrt{a^2+b^2} \end{equation} with $a$ and $b$ are the real and imaginary parts. ### Create a function to calculate the modulus of complex number To calculate the modulus of complex number a solution is to define a simple python function: >>> import math >>> def complexe_modulo(z): ... a = z.r ... COMMENT AJOUTER UNE COLONNE DE 1 À UNE MATRICE AVEC NUMPY ? (MACHINELEARNING; PYTHON)
__ Daidalos __ November15, 2019
Exemples de comment ajouter une colonne de 1 à une matrice avec numpy ### Ajouter une colonne de 1 à une matrice avec des données d'entraînement Considérons la matrice X avec des données d'entraînement (avec n=6 observations et d=3 "features"): \begin{equation} X = \left( \begin{array}{ccc} x_{11} & x_{12} & x_{13} \\\\ x_{21} & x_{22} & x_{23} \\\\ x_{31} & x_{32} & x_{33} \\\\ x_{41} & x_{42} & x_{43} \\\\ x_{51} & x_{52} & x_{53} \\\\ x_{61} & x_{62} & x_{63} \en ... COMMENT COPIER UN TABLEAU DE DONNÉES DATAFRAME AVEC PANDAS ? __ Daidalos __ November15, 2019
Exemple de comment copier un tableau de données DataFrame avec pandas ### Créer une dataframe Pour commencer créons une simple dataframe: >>> import pandas as pd >>> import numpy as np >>> data = np.random.randint(100, size=(10,5)) >>> df = pd.DataFrame(data=data,columns=) >>> df a b c d e 0 42 94 3 22 28 1 0 85 93 43 18 2 70 10 98 19 26 3 54 72 89 51 61 4 13 44 94 28 34 5 79 4 89 33 81 6 6 ... HOW TO COPY A DATAFRAME WITH PANDAS IN PYTHON ? __ Daidalos __ November14, 2019
Example of how to copy a data frame with pandas in python: ### Create a dataframe To start let's create a simple dataframe: >>> import pandas as pd >>> import numpy as np >>> data = np.random.randint(100, size=(10,5)) >>> df = pd.DataFrame(data=data,columns=) >>> df a b c d e 0 42 94 3 22 28 1 0 85 93 43 18 2 70 10 98 19 26 3 54 72 89 51 61 4 13 44 94 28 34 5 79 4 89 33 81 6 69 37 84 89 ... HOW TO PREPEND AN N-BY-1 COLUMN OF ONES TO A MATRIX IN PYTHON USING NUMPY ? (MACHINE LEARNING) __ Daidalos __ November14, 2019
Examples of how to prepend an n-by-1 column of ones to a matrix of training input data: ### Prepend an n-by-1 column of ones to a training dataset Let's consider the following matrix X of training data X (with n=6 observations and d=3 features): \begin{equation} X = \left( \begin{array}{ccc} x_{11} & x_{12} & x_{13} \\\\ x_{21} & x_{22} & x_{23} \\\\ x_{31} & x_{32} & x_{33} \\\\ x_{41} & x_{42} & x_{43} \\\\ x_{51} & x_{52} & x_{53} \\\\ x_{61} & x_{62} & x_{63}\end ...
HOW TO COUNT THE OCCURRENCE OF AN ELEMENT IN A PANDAS DATA FRAMECOLUMN ?
__ Daidalos __ November08, 2019
Examples of how to count the occurrence of an element in a pandas data frame column: ### Using value_counts() Lets take for example the file (https://archive.ics.uci.edu/ml/datasets/default+of+credit+card+clients#) that can be downloaded (https://archive.ics.uci.edu/ml/machine-learning-databases/00350/) >>> import pandas as pd >>> df = pd.read_excel('default of credit card clients.xls', header=1) To get the count of d ... COMMENT COMPTER LE NOMBRE D'OCCURRENCES POUR LES ÉLÉMENTS D'UNE COLONNE DANS UNE DATA FRAME AVEC PANDAS ? __ Daidalos __ November08, 2019
Exemple de comment compter le nombre d'occurrences sur les éléments d'une colonne avec une data frame pandas: ### Nombre d'occurrences avec la fonction value_counts() Soit par exemple le fichier de données suivant (https://archive.ics.uci.edu/ml/datasets/default+of+credit+card+clients#) que l'on peut télécharger (https://archive.ics.uci.edu/ml/machine-learning-databases/00350/) >>> import pandas as pd >>> df = pd.read_ex ... HOW TO GET THE SHAPE OF A DATAFRAME IN PYTHON WITH PANDAS ? __ Daidalos __ November08, 2019
Examples of how to get the shape of a DataFrame in python with panda: ### Get DataFrame shape Let's consider the following file train.csv (that can be downloaded on kaggle): >>> import pandas as pd >>> df = pd.read_csv('train.csv') To get the shape a solution is touse the function
(https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.shape.html): >>> print(df.shape) (1460, 81) ### Number of columns Get the number ofcolumns ...
COMMENT OBTENIR LA TAILLE D'UN TABLEAU DE DONNÉES DATAFRAME AVECPANDAS ?
__ Daidalos __ November08, 2019
Exemples de comment obtenir la taille d'un tableau de données DataFrame avec pandas: ### Taille d'une DataFrame avec shape() Soit par exemple le fichier csv suivant train.csv (que l'on peut télécharger sur kaggle). Pour lire le fichier il existe la fonction pandas read_csv(): >>> import pandas as pd >>> df = pd.read_csv('train.csv') On peut alors utiliser la fonction (https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.shape.html)pour ob ...
HOW TO READ A SIMPLE TEXT FILE IN PYTHON ? __ Daidalos __ November08, 2019
Example of how to read a simple text file in python: ### Read a text file Let's consider the following file (https://www.w3.org/TR/PNG/iso_8859-1.txt). To read and close the file do: f = open('iso_8859-1.txt', 'r') f.closed ### Get all the file content To get all the file content a solution is to use f.read(): f = open('iso_8859-1.txt', 'r') data = f.read() f.close and print the content using print(data) returns here: Th ... HOW TO ADD SOME TEXT ON A MATPLOTLIB FIGURE IN PYTHON ? __ Daidalos __ November07, 2019
Examples of how to add some text on a matplotlib figure in python: ### Add text using pyplot.text() To add some text on a matplotlib figure, a solution is to use the function (http://matplotlib.org/api/pyplot_api.html?highlight=figtext) that needs the position of the text (x,y) and the text itself. An example with the text 'Hello World !' at the coordinates (1,35): #!/usr/bin/env python import numpy as np import matplotlib.pyplot asplt x ...
HOW TO RENAME A COLUMN NAME OF A DATAFRAME IN PANDAS ? __ Daidalos __ November07, 2019
Examples of how to rename a column name of a DataFrame in pandas: ### Rename a column name using rename() Let's consider the following dataframe >>> import numpy as np >>> import pandas as pd >>> import numpy as np >>> data = np.random.randint(100, size=(5,5)) >>> df = pd.DataFrame(data=data,columns=) >>> df c1 c2 c3 c4 c5 0 33 93 44 10 38 1 77 27 78 15 84 2 33 50 42 30 63 3 35 54 39 8 21 4 77 11 3 ... HOW TO REMOVE ONE OR MULTIPLE ROWS IN A PANDAS DATAFRAME IN PYTHON ? __ Daidalos __ November01, 2019
Examples of how to remove one or multiple rows in a pandas DataFrame in python ### Remove one row Lets create a simple dataframe with pandas >>> data = np.random.randint(100, size=(10,10)) >>> df = pd.DataFrame(data=data) >>> df 0 1 2 3 4 5 6 7 8 9 0 13 44 3 55 13 98 44 87 20 52 1 72 72 96 18 68 84 81 41 8 75 2 53 71 97 27 21 44 61 9 59 87 3 40 94 49 7 56 93 17 62 71 14 4 4 20 56 45 89 78 9 ... HOW TO REMOVE ONE OR MULTIPLE COLUMNS IN A PANDAS DATAFRAME IN PYTHON?
__ Daidalos __ November01, 2019
Examples of how to remove one or multiple columns in a pandas DataFrame in python: ### Remove one column Lets create a simple dataframe >>> import pandas as pd >>> import numpy as np >>> data = np.random.randint(100, size=(10,10)) >>> data array([, , , , [84, 38, 45, 75, 9, 45, 89, 19, 6 ... HOW TO SELECT ONE OR MULTIPLE ROWS IN A PANDAS DATAFRAME IN PYTHON ? __ Daidalos __ November01, 2019
Examples of how to select one or multiple rows in a pandas DataFrame in python: ### Create a DataFrame Lets consider the following dataset train.csv (that can be downloaded on (https://www.kaggle.com/c/house-prices-advanced-regression-techniques/data)). To read the file a solution is to use (https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_csv.html): >>> import pandas as pd >>> df = pd.read_csv('train.csv') >>> df.shape(1460, 8 ...
HOW TO REPLACE SOME ELEMENTS OF A MATRIX USING NUMPY IN PYTHON ? __ Daidalos __ October31, 2019
Examples of how to replace some elements of a matrix using numpy in python: ### Replace some elements of a 1D matrix Let's try to replace the elements of a matrix called M strictly lower than 5 by the value -1: >>> import numpy as np >>> M = np.arange(10) >>> M array() >>> M = -1 >>> M array() ### Replace some elements of a 2D matrixAnother exam ...
COMMENT SUPPRIMER UNE OU DES LIGNES D'UN TABLEAU DE DONNÉES (DATAFRAME) AVEC PANDAS ? __ Daidalos __ October29, 2019
Exemples de comment supprimer une ou des lignes d'un tableau de données (DataFrame) avec pandas: ### Supprimer une ligne Créons une simple DataFrame avec pandas: >>> import pandas as pd >>> import numpy as np >>> data = np.random.randint(100, size=(10,10)) >>> df = pd.DataFrame(data=data) >>> df 0 1 2 3 4 5 6 7 8 9 0 13 44 3 55 13 98 44 87 20 52 1 72 72 96 18 68 84 81 41 8 75 2 53 71 97 27 21 4461 9 59 87 ...
COMMENT RENOMMER UNE COLONNE D'UN TABLEAU DE DONNÉES (DATAFRAME) AVECPANDAS ?
__ Daidalos __ October29, 2019
Exemples de comment renommer une ou des colonnes d'un tableau de données (DataFrame) avec pandas sous python: ### Renommer une colonne avec rename() Soit la DataFrame suivante: >>> import numpy as np >>> import pandas as pd >>> import numpy as np >>> data = np.random.randint(100, size=(5,5)) >>> df = pd.DataFrame(data=data,columns=) >>> df c1 c2 c3 c4 c5 0 33 93 44 10 38 1 77 27 78 15 84 2 33 50 42 30 63 3 35...
COMMENT SUPPRIMER UNE OU DES COLONNES D'UN TABLEAU DE DONNÉES (DATAFRAME) AVEC PANDAS ? __ Daidalos __ October29, 2019
Exemples de comment supprimer une colonne d'un tableau de données (DataFrame) avec pandas: ### Supprimer une colonne Créons une simple DataFrame avec pandas: >>> import pandas as pd >>> import numpy as np >>> data = np.random.randint(100, size=(10,10)) >>> data array([, , , , [84, 38, 45 ... COMMENT SÉLECTIONNER UNE OU PLUSIEURS LIGNES D'UN TABLEAU DE DONNÉES (DATAFRAME) AVEC PANDAS ? __ Daidalos __ October29, 2019
Exemple de comment sélectionner une ou plusieurs lignes de données dans une DataFrame avec pandas sous python: ### Créer une DataFrame avec Pandas Soit par exemple le fichier csv suivant train.csv (que l'on peut télécharger sur (https://www.kaggle.com/c/house-prices-advanced-regression-techniques/data)). Pour lire le fichier il existe la fonction pandas (https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_csv.html): >>> import pandas as ... HOW TO SELECT ONE OR MULTIPLE COLUMNS IN A PANDAS DATAFRAME IN PYTHON?
__ Daidalos __ October29, 2019
Example of how to extract one or several columns of data in a pandas dataframe ### Create a dataframe with pandas Let's consider the csv file train.csv (that can be downloaded on (https://www.kaggle.com/c/house-prices-advanced-regression-techniques/data)). To read the file a solution is to use (https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_csv.html): >>> import pandas as pd >>> df = pd.read_csv('train.csv') >>> df.shape(1460 ...
HOW TO EXTRACT ONE OR SEVERAL COLUMNS OF DATA IN A PANDAS DATAFRAME ? __ Daidalos __ October29, 2019
Exemple de comment sélectionner une ou des colonnes de données dans une DataFrame avec pandas ? ### Créer une DataFrame avec Pandas Soit par exemple le fichier csv suivant train.csv (que l'on peuttélécharger sur
(https://www.kaggle.com/c/house-prices-advanced-regression-techniques/data)). Pour lire le fichier il existe la fonction pandas (https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_csv.html): >>> import pandas as pd >>> df = ... HOW TO FILTER MISSING DATA (NAN OR NULL VALUES) IN A PANDAS DATAFRAME?
__ Daidalos __ October28, 2019
Examples of how to work with missing data (NAN or NULL values) in a pandas DataFrame: ### Create a DataFrame with Pandas Let's consider the csv file train.csv (that can be downloaded on (https://www.kaggle.com/c/house-prices-advanced-regression-techniques/data)). To read the file a solution is to use (https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_csv.html): >>> import pandas as pd >>> data = pd.read_csv('train.csv') Get DataFr...
FILTRER LES DONNÉES MANQUANTES (NAN, NULL) D'UNE DATAFRAME AVECPANDAS ?
__ Daidalos __ October24, 2019
Exemple de comment filtrer les données manquantes (NAN, NULL) d'une DataFrame avec Pandas ? ### Créer une DataFrame avec Pandas Soit par exemple le fichier csv suivant train.csv (que l'on peuttélécharger sur
(https://www.kaggle.com/c/house-prices-advanced-regression-techniques/data)). Pour lire le fichier il existe la fonction pandas (https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_csv.html): >>> import pandas as pd >>> data = pd ... HOW TO ADD METADATA TO A DATA FRAME WITH PANDAS IN PYTHON ? __ Daidalos __ October22, 2019
Example of how to add metadata to a data frame with pandas in python: ### Create a data frame with pandas Example of how to create a simple data frame with pandas import pandas as pd import numpy as np data = np.arange(1,13) data = data.reshape(3,4) columns =index = df =
pd.DataFrame(data=data,index=index,columns=columns) ### Add metadata A solution to add metadata: df.scale = 0.1 df.offset = 1 ... COMMENT AJOUTER DES METADATA À UNE DATA FRAME AVEC PANDAS SOUS PYTHON?
__ Daidalos __ October22, 2019
Exemple de comment ajouter des metadata à une data frame avec pandas sous python: ### Créer une data frame avec pandas Exemple de comment créer une simple data frame avec pandas import pandas as pd import numpy as np data = np.arange(1,13) data = data.reshape(3,4)columns = index =
df = pd.DataFrame(data=data,index=index,columns=columns) ### Ajouter des metadata On peut alors ajouter des metadata à ... HOW TO SAVE A LARGE DATASET IN A HDF5 FILE USING PYTHON ? (QUICKGUIDE)
__ Daidalos __ October22, 2019
Examples of how to store a large dataset in a hdf5 file using python: ### Create arrays of data Let's consider the following matrices of integers (dtype='i'): >>> import numpy as np >>> A = np.random.randint(100, size=(4,4)) >>> A array() matrix B of dimensions (5,3,3) >>> B = np.random.randint(100, size=(5,3,3)) >>> B array([[, , [19, 39, ... COMMENT SÉLECTIONNER UNE OU PLUSIEURS COLONNES D'UN TABLEAU DE DONNÉES (OU DATAFRAME) AVEC PANDAS ? __ Daidalos __ October21, 2019
Exemple de comment sélectionner une ou des colonnes de données dans une DataFrame avec pandas ? ### Créer une DataFrame avec Pandas Soit par exemple le fichier csv suivant train.csv (que l'on peuttélécharger sur
(https://www.kaggle.com/c/house-prices-advanced-regression-techniques/data)). Pour lire le fichier il existe la fonction pandas (https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_csv.html): >>> import pandas as pd >>> df = ... SAUVEGARDER UNE MATRICE DE DONNÉES DE GRANDE TAILLE ET/OU DE PLUSIEURS DIMENSIONS DANS UN FICHIER HDF5 EN PYTHON ? __ Daidalos __ October21, 2019
Pour sauvegarder dans un fichier, des données stockées dans une matrice il existe plusieurs approches. Dans le cas d'un simple tableau de données avec quelques colonnes et/ou lignes on peut utiliser un simple fichier ascii ou un fichier csv. Cependant, si les données sont stockées dans des matrices à plusieurs dimensions ou si le volume de données est important il est préférable par exemple d'utiliser le format de données hdf5. Exemple avec python de comment créer un fichier hdf5, stocker les do ... HOW TO GET THE NAMES (TITLES OR LABELS) OF A PANDAS DATA FRAME INPYTHON ?
__ Daidalos __ October21, 2019
Examples of how to get the names (titles or labels) of a pandas data frame in python ### Get the row names of a pandas data frame Let's consider a data frame called df. to get the row names a solution is to do: >>> df.index ### Get the row names of a pandas data frame (Exemple 1) Let's create a simple data frame: >>> import pandas as pd >>> import numpy as np >>> data = np.arange(1,13) >>> data = data.reshape(3,4) >>> data array([, ... COMMENT OBTENIR LES NOMS (TITRES, LABELS) ASSOCIÉS AUX LIGNES D'UN TABLEAU DE DONNÉES (DATAFRAME) AVEC PANDAS ? __ Daidalos __ October21, 2019
Exemple de comment obtenir les noms (titres, labels) associés aux lignes d'un tableau de données (data frame) avec pandas sous python: ### Obtenir le noms associés aux lignes d'une data frame Soit une data frame nommée df, pour obtenir le noms associés aux lignes on peut faire comme ceci: >>> df.index ### Obtenir le noms associés aux lignes d'une data frame (Exemple 1) Créons une simple data frame >>> import pandas as pd >>> import numpy as np >>> data = np.ar ... HOW TO READ A CSV FILE USING PANDAS IN PYTHON ? __ Daidalos __ October20, 2019
Example of how to read a csv file using pandas in python: ### Read a csv file Let's consider the csv file train.csv (that can bedownloaded on
(https://www.kaggle.com/c/house-prices-advanced-regression-techniques/data)). To read the csv file a solution is to use the pandas function (https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_csv.html): >>> import pandas as pd >>> data = pd.read_csv('train.csv') Get arraydimensions: >>> ...
COMMENT LIRE UN FICHIER DE DONNÉES CSV EN PYTHON AVEC PANDAS ? __ Daidalos __ October20, 2019
Exemple de comment lire un fichier de données csv avec pandas : ### Lire un fichier csv Soit par exemple le fichier csv suivant train.csv (que l'on peut télécharger sur (https://www.kaggle.com/c/house-prices-advanced-regression-techniques/data)). Pour lire le fichier il existe la fonction pandas (https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_csv.html): >>> import pandas as pd >>> data = pd.read_csv('train.csv') Obtenirles dim ...
HOW TO EXTRACT COLUMNS NAMES OF A PANDAS DATAFRAME IN PYTHON ? __ Daidalos __ October20, 2019
With pandas to get the names of a dataframe, there is the attributecolumns
((https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.columns.html)): >>> DataFrame.columns Examples of applications: ### Read a cvs data file and create a dataframe with pandas Let's consider the cvs data file train.csv (that can be downloaded on (https://www.kaggle.com/c/house-prices-advanced-regression-techniques/data)) >>> import pandas as pd >>> dat ... COMMENT EXTRAIRE EN PYTHON LE NOMS DES COLONNES D'UN TABLEAU DE DONNÉES (DATAFRAME) AVEC PANDAS ? __ Daidalos __ October18, 2019
Avec pandas pour extraire le noms des colonnes d'un tableau de données (DataFrame) on peut faire comme ceci ((https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.columns.html)): >>> DataFrame.columns Exemple d'utilisation: ### Lire un fichier cvs et créer un tableau de données (dataframe) avec panda Soit le fichier cvs suivant train.csv (que l'on peut télécharger sur (https://www.kaggle.com/c/house-prices-advanced-regression-techniqu...
HOW TO GET THE NUMBER OF DIMENSIONS OF A MATRIX USING NUMPY IN PYTHON?
__ Daidalos __ October17, 2019
Exemple de comment déterminer le nombre de dimensions d'une matrice en python: ### Get the number of dimensions of a matrix Let's consider the following matrix: >>> import numpy as np >>> A = np.array() >>> A array() To get the shape of the matrix, a solution is to first use (https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.shape.html): >>> A.shape (3, 3) and ... COMMENT DÉTERMINER LE NOMBRE DE DIMENSIONS D'UNE MATRICE EN PYTHON ? __ Daidalos __ October17, 2019
Exemple de comment déterminer le nombre de dimensions d'une matrice en python: ### Déterminer le nombre de dimensions d'une matrice Soit la matrice suivante >>> import numpy as np >>> A = np.array() >>> A array() Pour déterminer la forme d'une matrice on peut alorsutiliser
(https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.shape.html): >>> A.shape (3, 3) et en ... HOW TO CREATE AN IDENTITY MATRIX USING NUMPY IN PYTHON ? __ Daidalos __ October17, 2019
Examples of how to create an identity matrix using numpy in python ? ### Using the numpy function identity Let's create the following identity matrix \begin{equation} I = \left( \begin{array}{ccc} 1 & 0 & 0 \\\\ 0 & 1 & 0 \\\\ 0 & 0 & 1 \end{array}\right) \end{equation} using numpy function identity: >>> import numpy as np >>> I = np.identity(3) >>> I array() Another example: \begin{ ... COMMENT CRÉER UNE MATRICE IDENTITÉ (OU MATRICE UNITÉ) AVEC NUMPY ETPYTHON ?
__ Daidalos __ October16, 2019
Exemple de comment créer une matrice identité (ou matrice unité) avec numpy et python: ### Avec la fonction numpy identity Pour créer une matrice identité \begin{equation} I = \left( \begin{array}{ccc} 1 & 0 & 0 \\\\ 0 & 1 & 0 \\\\ 0 & 0 & 1 \end{array}\right) \end{equation} >>> import numpy as np >>> I = np.identity(3) >>> I array() Autre exemple \begin{equation} I = \left( \begin ... HOW TO CREATE A DATA FRAME IN PYTHON USING PANDAS ? __ Daidalos __ October15, 2019
Examples of how to create a data frame using the python module pandas ### Create a data frame using an array Import pandas and numpy: >>> import pandas as pd >>> import numpy as np Let's consider the following matrix \begin{equation} data = \left( \begin{array}{ccc} 1 & 2 & 3 & 4 \\\\ 5 & 6 & 7 & 8 \\\\ 9 & 10 & 11 & 12 \end{array}\right) \end{equation} >>> data = np.arange(1,13) >>> data = data.reshape(3,4) >>> data array([, [ 5 ... COMMENT CRÉER UN TABLEAU DE DONNÉES ("DATAFRAME") AVEC PANDAS SOUSPYTHON ?
__ Daidalos __ October15, 2019
Exemples de comment créer un tableau de données (ou "dataframe") avec pandas sous python: ### Créer une simple data frame à partir d'une matrice Importer les modules pandas et numpy: >>> import pandas as pd >>> import numpy as np Soit la matrice 2D suivante: \begin{equation} data = \left( \begin{array}{ccc} 1 & 2 & 3 & 4 \\\\ 5 & 6 & 7 & 8 \\\\ 9 & 10 & 11 & 12 \end{array}\right) \end{equation} >>> data = np.arange(1,13) >>> data = data.reshape(3,4) >> ...* 1
* 2
* 19
__ Search
------------------------- Notes Articles Sources Codes © 2019 science-emergence.com, All rights reservedSSL SECURITY
To protect your privacy, the site is secure through a SSL securitytechnology.
Details
Copyright © 2024 ArchiveBay.com. All rights reserved. Terms of Use | Privacy Policy | DMCA | 2021 | Feedback | Advertising | RSS 2.0