Skip to content

In this notebook We will try to understand python data types

Notifications You must be signed in to change notification settings

dhamvi01/Python-Objects

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Python-Objects

In this notebook We will try to understand python data types.

Every value in Python has a datatype. Since everything is an object in Python programming, data types are actually classes and variables are instance (object) of these classes. There are various data types in Python. Some of the important types are listed below.

  1. Numbers
  2. String
  3. List
  4. Tuple
  5. Dictionary
  6. DataFrame

#1. Numbers Number data types store numeric values. Number objects are created when you assign a value to them.Python supports four different numerical types −

  • int (signed integers)
  • long (long integers, they can also be represented in octal and hexadecimal)
  • float (floating point real values)
  • complex (complex numbers)

#2. Strings

Strings in Python are identified as a contiguous set of characters represented in the quotation marks.

Python allows for either pairs of single or double quotes. Subsets of strings can be taken using the slice operator ([ ] and [:] ) with indexes starting at 0 in the beginning of the string and working their way from -1 at the end.

The plus (+) sign is the string concatenation operator and the asterisk (*) is the repetition operator

#3. List

List is an ordered sequence of items. It is one of the most used datatype in Python and is very flexible. All the items in a list do not need to be of the same type.

Declaring a list is pretty straight forward. Items separated by commas are enclosed within brackets [ ].

#4. Tuple

A tuple is another sequence data type that is similar to the list. A tuple consists of a number of values separated by commas. Unlike lists, however, tuples are enclosed within parentheses.

#5. Dictionary

Dictionary is an unordered collection of key-value pairs.

It is generally used when we have a huge amount of data. Dictionaries are optimized for retrieving data. We must know the key to retrieve the value.

In Python, dictionaries are defined within braces {} with each item being a pair in the form key:value. Key and value can be of any type.

#6. DataFrames

A Data frame is a two-dimensional data structure, i.e., data is aligned in a tabular fashion in rows and columns

A pandas DataFrame can be created using various inputs like −

  • Lists
  • dict
  • Series
  • Numpy ndarrays
  • Another DataFrame

About

In this notebook We will try to understand python data types

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published