pandas.lreshape() function in Python Last Updated : 15 Jul, 2025 Comments Improve Suggest changes Like Article Like Report This method is used to reshape long-format data to wide. This is the generalized inverse of DataFrame.pivot. Syntax : pandas.lreshape(data, groups, dropna=True, label=None) Arguments : data : DataFramegroups : dict {new_name : list_of_columns}dropna : boolean, default True Below is the implementation of the above method with an example : Python3 # importing package import numpy import pandas as pd # create and view data data = pd.DataFrame({ 'hr1': [514, 573], 'hr2': [545, 526], 'team': ['Red Sox', 'Yankees'], 'year1': [2007, 2007], 'year2': [2008, 2008] }) print(data) # use pandas.lreshape() method print(pd.lreshape(data, {'year': ['year1', 'year2'], 'hr': ['hr1', 'hr2']})) # This code is contributed by rakeshsahni Output: Comment More infoAdvertise with us Next Article Python | Pandas Dataframe.at[ ] D deepanshu_rustagi Follow Improve Article Tags : Python Python-pandas Pandas-DataFrame-Methods Practice Tags : python Similar Reads pandas.eval() function in Python This method is used to evaluate a Python expression as a string using various back ends. It returns ndarray, numeric scalar, DataFrame, Series. Syntax : pandas.eval(expr, parser='pandas', engine=None, truediv=True, local_dict=None, global_dict=None, resolvers=(), level=0, target=None, inplace=False) 2 min read How to Install Pandas in Python? Pandas in Python is a package that is written for data analysis and manipulation. Pandas offer various operations and data structures to perform numerical data manipulations and time series. Pandas is an open-source library that is built over Numpy libraries. Pandas library is known for its high pro 5 min read Python | Pandas Index.delete() 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 Index.delete() function returns a new object with the passed locations deleted. 2 min read Python | Pandas Index.delete() 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 Index.delete() function returns a new object with the passed locations deleted. 2 min read Python | Pandas Dataframe.at[ ] 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 at[] is used to return data in a dataframe at the passed location. The passed l 2 min read Python | Pandas Index.to_frame() 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 Index.to_frame() function create a dataFrame from the given index with a column 2 min read Like