Find the best tutors and institutes for Python Training

Find Best Python Training classes

Please select a Category.

Please select a Locality.

No matching category found.

No matching Locality found.

Outside India?

Search for topics

Python Important Operation Formats and Sytnax.

Silvia Priya
29 Mar 0 0

 Hello Python Enthusiast,

Though Python is considered as one of the easisest language to learn in the market, many freshers and beginners will find great difficulty in understansing the syntax and also how to achieve a operation under a given situation.

To make that more easier and clearer for you, im posting some of the important operations and how to achieve it with their syntax.


  • Any word enclosed inside the <> means it is a general form, you can replace it with your dataframe or column name or index name depending upon what mentioned in the syntax.
  • Where ever [] or single quotes or double quotes are mentioned use it as it is.
  • Words mentioned without any <> symbols represents the keywords , so use as it is.

Come, lets learn!!

Basic operations in pandas


  • Replace a column value in a dataframe

If you want single value to be replaced to single value or multiple values to be replaced by multiple values follow the below statement accordingly.





  • To read row by row and index by index in pandas

Reading the rows and the index postitions can be done using the following statements.

for <index>,<row> in <dataframe>.iterrows():

               print(<row>) #prints the rows inside the dataframe

               print(<index>) #prints the index value of that row


  • To concatenate multiple dataframes into a single one

To combine three data frames into one single dataframe.


All the dataframes which we are planning to combine must be put inside the list[] in concat function.


  • To view the top 5 lines of a dataframe

To print the top 5 lines of the dataframe.



  • To find out the columns having null values in a dataframe

To find the columns holding null values in it.

<null_columns> = <dataframe>.columns[<dataframe>.isnull().any()]

Isnull() - checks for null values

Any() - even if one row has null value also take that column

Now the null_columns  will contain a list of columns having null values in that data frame.


  • To find out the sum of null values in every column in a dataframe

How many null values a column holds can be identified by using the below format.


 Apply the isnull() check on the columns identified as having null values and perform a sum on it.


  • To find out any specific column is having  null values  in it

To check whether any specific column is having null value in it or not.

<dataframe>[<dataframe>[“<column name>”].isnull()]

 To check whether the specified column name is having any null values in the dataframe.


  • To find out a row which contains atleast one null value in it

Basically the property axis=1 represents the column names in the dataframe and axis=0 represents the row names in the dataframe.


To check whether any value is null on any one of the column in the dataframe, if so that complete row will be returned.


  • To replace a null value in a column with some other value

To replace the null value in a column with some other value use fillna 

<dataframe>[‘<columnname>’]=<dataframe>[‘<columnname>’].fillna(‘<value to replace>’)


What-ever posted above are about the functions used under the pandas library in python, similarly will post more about the basic python syntaxes and libraries like numpy,matplotlib etc.


Thank you!!

0 Dislike
Follow 1

Please Enter a comment


Other Lessons for You

Why Continuous learning is Important for Career
Learning plays a significant role in day to day life of every individual. It has instant as well as long term benefits for each and every one. It will lead as well as guide individuals to gain principles,...

Euonus IT | 11 Jun

0 0

Python programming - Applications
If you’re thinking of learning Python? Or if you recently started learning it? You may be asking yourself: "What exactly can I use Python for?" There are so many applications for python, but there...

Identity operators
Identity operators Operation Syntax Function Identity a is b is_(a, b) Membership operators Operation Syntax Function Containment obj in seq contains(seq, obj)

Ram Kumar | 12 May

0 0

Relational operators
Operation Syntax Function Ordering a < b lt(a, b) Ordering a <= b le(a, b) Equality a == b eq(a, b) Ineqality a != b ne(a, b) Ordering a >= b ge(a, b) Ordering a > b gt(a, b)

Ram Kumar | 12 May

0 0

Bit-wise operators
Operation Syntax Function Bitwise And a & b and_(a, b) Bitwise Exclusive Or a ^ b xor(a, b) Bitwise Inversion ~ a invert(a) Bitwise Or a b or_(a, b) Left...

Ram Kumar | 12 May

0 0

Find Best Python Training classes?

Find Now » is India's largest network of most trusted tutors and institutes. Over 25 lakh students rely on, to fulfill their learning requirements across 1,000+ categories. Using, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 6.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more