We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Tag: or

Python : Check if all elements in a List are same or matches a condition

In this article we will dicuss different ways to check if all element in a given List are same or matches a condition. Suppose we have a list of string i.e. Advertisements # List of string listOfStrings = [‘Hello’] * 10 Now let’s use python all() function to check if all elements in the given …

Python : Check if all elements in a List are same or matches a conditionRead More

Python: How to sort a list of tuples by 2nd Item using Lambda Function or Comparator

In this article we will discuss how to sort a list of tuple using 2nd or i th item of tuple. Suppose we have a list of tuple i.e. words and thier frequency count, Advertisements # List of tuples i.e. word and its frequency count wordFreq = [ (‘the’ , 34) , (‘at’ , 23), …

Python: How to sort a list of tuples by 2nd Item using Lambda Function or ComparatorRead More

Python : How to remove element from a list by value or Index | remove() vs pop() vs del

In this article we will discuss different ways to remove an elements from list. Remove an element from List by value using list.remove() Python’s list provides a member function to remove an element from list i.e. Advertisements list.remove(value) It removes the first occurrence of given element from the list. For example, Frequently Asked: Convert a …

Python : How to remove element from a list by value or Index | remove() vs pop() vs delRead More

Python : How to replace single or multiple characters in a string ?

In this article we will discuss how to replace single or multiple characters in a string in Python. Python provides a str.replace() function i.e. Advertisements str.replace(old, new , count) It returns a new string object that is a copy of existing string with replaced content. Also, If count is not provides then it will return …

Python : How to replace single or multiple characters in a string ?Read More

Python Pandas : Replace or change Column & Row index names in DataFrame

In this article we will discuss how to change column names or Row Index names in DataFrame object. First of all, create a dataframe object of students records i.e. Advertisements students = [ (‘jack’, 34, ‘Sydeny’) , (‘Riti’, 30, ‘Delhi’ ) , (‘Aadi’, 16, ‘New York’) ] # Create a DataFrame object dfObj = pd.DataFrame(students, …

Python Pandas : Replace or change Column & Row index names in DataFrameRead More

Select Rows & Columns by Name or Index in using loc & iloc

In this article we will discuss different ways to select rows and columns in DataFrame. DataFrame provides indexing labels loc & iloc for accessing the column and rows. Also, operator [] can be used to select columns. Let’s discuss them one by one, Advertisements First create a DataFrame object i.e. students = [ (‘jack’, 34, …

Select Rows & Columns by Name or Index in using loc & ilocRead More

Python : How to unpack list, tuple or dictionary to Function arguments using * & **

In this article we will discuss how to unpack a list, tuple and dictionary to function arguments. Suppose we have a function with 3 parameters i.e. Advertisements def updateStudentDetail(name, phone, address): print(“**********************”) print(“Student Name : “, name) print(“Student phone : “, phone) print(“Student address : “, address) We can call this function and pass three …

Python : How to unpack list, tuple or dictionary to Function arguments using * & **Read More

Python Pandas : Drop columns in DataFrame by label Names or by Index Positions

In this article we will discuss how to drop columns from a DataFrame object. DataFrame provides a member function drop() i.e. Advertisements DataFrame.drop(labels=None, axis=0, index=None, columns=None, level=None, inplace=False, errors=’raise’) It accepts a single Label Name or list of Labels and deletes the corresponding columns or rows (based on axis) with that label. It considers the …

Python Pandas : Drop columns in DataFrame by label Names or by Index PositionsRead More

19
1.096.910,95