Tuesday, 5 October 2021

Operations On Dataframe in Python

Checking data types of each Column in a Data Frame.


  • If you want to check the data type of each column, because whenever you have been given a data, you want to really check what is the structure of the data; that means, which variable has which data type?
  • In, that case you can use dtypes, because that returns a series with the data type of each column and the syntax would be you use dtypes along with the Data Frame name.
  • So, Data Frame.dtypes will give you a series with the data type of each column

Here is the syntax.

Syntax = DataFrame.dtypes

                                      



Count of unique data types

  • So, now we have an overall idea about what are the data types that we are going to work with using the cars_data. 
  • There is also an option where you can get the count of unique data types available in your Data Frame.
  • So, in that case get_dtype_counts, returns the counts of unique data types in the data frame.


Here is the syntax.

Syntax = get_dtype_counts()





Selecting data based on data types

  • So, now we also have an overall idea about the count of unique data types that we are going to handle with. 

  • So, now, we know about how to get the data type of each variables. So, there might be cases where you want to perform the operations only on a numerical data type.

  • Similarly, there can be cases where you are going to work with only categorical data type.



Here is the syntax.

Syntax = pandas.DataFrame.select.dtypes()












Join us: https://t.me/jupyter_python

0 Comments:

Post a Comment

Popular Posts

Categories

AI (32) Android (24) AngularJS (1) Assembly Language (2) aws (17) Azure (7) BI (10) book (4) Books (146) C (77) C# (12) C++ (82) Course (67) Coursera (198) Cybersecurity (24) data management (11) Data Science (106) Data Strucures (8) Deep Learning (13) Django (14) Downloads (3) edx (2) Engineering (14) Excel (13) Factorial (1) Finance (6) flask (3) flutter (1) FPL (17) Google (21) Hadoop (3) HTML&CSS (47) IBM (25) IoT (1) IS (25) Java (93) Leet Code (4) Machine Learning (46) Meta (18) MICHIGAN (5) microsoft (4) Nvidia (1) Pandas (3) PHP (20) Projects (29) Python (888) Python Coding Challenge (285) Questions (2) R (70) React (6) Scripting (1) security (3) Selenium Webdriver (2) Software (17) SQL (42) UX Research (1) web application (8)

Followers

Person climbing a staircase. Learn Data Science from Scratch: online program with 21 courses