DataFrame
Python Pandas
DataFrame
By : Mrs Sangeeta M Chauhan , Gwalior
? Sangeeta M Chauhan, Gwalior
What is Data Frame?
A Data frame is a 2D (two-dimensional) data structure, i.e., data is arranged in tabular form i.e. In the form of rows and columns. Or we can say that, Pandas DataFrame is similar to excel sheet Let's understand it through an example
Create DataFrame
pandas DataFrame can be created using the following constructor pandas.DataFrame ( data[, index, columns, dtype, copy]) The parameters of the constructor are as follows
Sr.No
Parameter & Description
1
DcoantastadnattsaatnakdeaslsvoarainooutshfeorrmDastalikFeranmdea.rray, series, map, lists, dict,
2
Ifnradmexe iFsoOr ptthieonraolwDelafabuellts,npth.aerrIanndgeex(nto) ifbneouisneddexfoisr ptahseserde.sulting
3
Cnpo.laurmrannsgeF(onr). Tchoilsumis nonllaybterulse, ifthneo iondpteixonisapl adsseefadu. lt syntax is -
4
Dtype Data type of each column.
5
CFaolpsey. This command is used for copying of data, if the default is
A pandas DataFrame can be created using various inputs like 1. Lists 2. dictionary 3. Series 4. Numpy ndarrays 5. Another DataFrame
Creating an Empty DataFrame
>>> import pandas as pd >>> df=pd.DataFrame() >>> df ? Empty DataFrame ? Columns: [] ? Index: []
Create a DataFrame from Lists
Example 1 (Simple List) >>> MyList=[10,20,30,40] >>> MyFrame=pd.DataFrame(MyList) >>> MyFrame
0 0 10 1 20 2 30 3 40
Example 1 (Simple List) >>> Friends = [['Shraddha','Doctor'],['Shanti','Teacher'],['Monica','Engineer']] >>> MyFrame=pd.DataFrame(Friends,columns=['Name','Occupation']) >>> MyFrame
Name Occupation 0 Shraddha Doctor 1 Shanti Teacher 2 Monica Engineer
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related searches
- python dataframe lambda
- dataframe apply function on column
- dataframe apply multiple columns
- dataframe column to list python
- convert array to dataframe pandas
- pandas convert dataframe to array
- dataframe datetime to date
- dataframe convert to datetime
- dataframe datetime format
- python dataframe datetime format
- create empty dataframe python
- python dataframe float format