This is wide_to_long
pd.wide_to_long(df,['t','l'],i=['id1','id2'],j='drop').reset_index(level=[0,1])
Out[52]:
id1 id2 t l
drop
1 1 2 a b
2 1 2 c d
1 3 4 g h
2 3 4 i j
More Related Contents:
- How to change column names from numbers to names [closed]
- How to provide a reproducible copy of your DataFrame with to_clipboard()
- Pandas groupby with delimiter join
- How to plot multiple Seaborn Jointplot in Subplot
- Find column whose name contains a specific string
- pandas: merge (join) two data frames on multiple columns
- Pandas Extract Number from String
- Conditionally fill column values based on another columns value in pandas
- No module named ‘pandas._libs.tslibs.timedeltas’ in PyInstaller
- Pandas deleting row with df.drop doesn’t work
- How to translate “bytes” objects into literal strings in pandas Dataframe, Python3.x?
- Count number of words per row
- pandas or python equivalent of tidyr complete
- Python pandas: remove everything after a delimiter in a string
- python pandas read_csv delimiter in column data
- Pandas number rows within group in increasing order
- pandas.read_csv from string or package data
- Python pandas: how to remove nan and -inf values
- Pandas ParserError EOF character when reading multiple csv files to HDF5
- Plot two levels of x_ticklabels on a pandas multi-index dataframe [duplicate]
- Format a number with commas to separate thousands
- Create a pandas DataFrame from generator?
- reading multiple files contained in a zip file with pandas
- How to compute jaccard similarity from a pandas dataframe
- Search and replace dots and commas in pandas dataframe
- How to convert string representation of dictionary in Pandas DataFrame to a new columns?
- Python Pandas – Lookup a variable column depending on another column’s value
- Why do I get a KeyError when using pandas apply?
- pandas scatter plotting datetime
- Pandas(Python) : Fill empty cells with with previous row value?