Python | Pandas Series.iteritems() Last Updated : 12 Feb, 2019 Comments Improve Suggest changes Like Article Like Report Pandas series is a One-dimensional ndarray with axis labels. The labels need not be unique but must be a hashable type. The object supports both integer- and label-based indexing and provides a host of methods for performing operations involving the index. Pandas Series.iteritems() function iterates over the given series object. the function iterates over the tuples containing the index labels and corresponding value in the series. Syntax: Series.iteritems() Parameter : None Returns : tuples Example #1: Use Series.iteritems() function to iterate over all the elements in the given series object. Python3 # importing pandas as pd import pandas as pd # Creating the Series sr = pd.Series([10, 25, 3, 25, 24, 6]) # Create the Index index_ = ['Coca Cola', 'Sprite', 'Coke', 'Fanta', 'Dew', 'ThumbsUp'] # set the index sr.index = index_ # Print the series print(sr) Output : Now we will use Series.iteritems() function to iterate over all the elements in the given series object. Python3 1== # iterate over all the elements for items in sr.iteritems(): print(items) Output : As we can see in the output, the Series.iteritems() function has successfully iterated over all the elements in the given series object. Example #2 : Use Series.iteritems() function to iterate over all the elements in the given series object. Python3 # importing pandas as pd import pandas as pd # Creating the Series sr = pd.Series([11, 21, 8, 18, 65, 84, 32, 10, 5, 24, 32]) # Create the Index index_ = pd.date_range('2010-10-09', periods = 11, freq ='M') # set the index sr.index = index_ # Print the series print(sr) Output : Now we will use Series.iteritems() function to iterate over all the elements in the given series object. Python3 1== # iterate over all the elements for items in sr.iteritems(): print(items) Output : As we can see in the output, the Series.iteritems() function has successfully iterated over all the elements in the given series object. Comment More infoAdvertise with us Next Article Python | Pandas Series.iteritems() S Shubham__Ranjan Follow Improve Article Tags : Python Pandas Python-pandas Python pandas-series-methods AI-ML-DS With Python +1 More Practice Tags : python Similar Reads Pandas query() Method Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric Python packages. Pandas is one of those packages that makes importing and analyzing data much easier. Analyzing data requires a lot of filtering operations. Pandas Dataframe provide many 2 min read Pandas dataframe.insert()-Python DataFrame.insert() function in pandas inserts a new column into a DataFrame at a specified position. It allows you to specify the column index, column label and values to insert. This is particularly useful when you want to place a new column in a specific position instead of just appending it at th 4 min read Pandas dataframe.sum() DataFrame.sum() function in Pandas allows users to compute the sum of values along a specified axis. It can be used to sum values along either the index (rows) or columns, while also providing flexibility in handling missing (NaN) values. Example:Pythonimport pandas as pd data = { 'A': [1, 2, 3], 'B 4 min read Pandas DataFrame mean() Method Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric Python packages. Pandas is one of those packages and makes importing and analyzing data much easier. Pandas DataFrame mean() Pandas dataframe.mean() function returns the mean of the value 2 min read Python | Pandas dataframe.median() Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric python packages. Pandas is one of those packages and makes importing and analyzing data much easier. Pandas dataframe.median() function return the median of the values for the requested a 2 min read Python | Pandas Series.std() Pandas series is a One-dimensional ndarray with axis labels. The labels need not be unique but must be a hashable type. The object supports both integer- and label-based indexing and provides a host of methods for performing operations involving the index. Pandas Series.std() function return sample 2 min read Apply function to every row in a Pandas DataFrame Applying a function to every row in a Pandas DataFrame means executing custom logic on each row individually. For example, if a DataFrame contains columns 'A', 'B' and 'C', and you want to compute their sum for each row, you can apply a function across all rows to generate a new column. Letâs explor 3 min read Joining two Pandas DataFrames using merge() The merge() function is designed to merge two DataFrames based on one or more columns with matching values. The basic idea is to identify columns that contain common data between the DataFrames and use them to align rows. Let's understand the process of joining two pandas DataFrames using merge(), e 4 min read Pandas DataFrame.astype()-Python DataFrame.astype() function in pandas cast a pandas object such as a DataFrame or Series to a specified data type. This is especially useful when you need to ensure that columns have the correct type, such as converting strings to integers or floats to strings. For example:Pythonimport pandas as pd 3 min read Python | Pandas DataFrame.set_index() Pandas DataFrame.set_index() method sets one or more columns as the index of a DataFrame. It can accept single or multiple column names and is useful for modifying or adding new indices to your DataFrame. By doing so, you can enhance data retrieval, indexing, and merging tasks.Syntax: DataFrame.set_ 3 min read Like