Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23131

Create a market ID from Origin destination pair in Python [duplicate]

$
0
0

I have given an example here

       data = {"Origin": ["DEL", "ABC", "ABC", "ABC", "LHR", "SRE", "RLK", "ZUN"],"Destination": ["LHR", "FDE", "SRE", "FTU", "DEL", "ABC", "ZUN", "RLK"],"ORD": ["DELLHR", "ABCFDE", "ABCSRE", "ABCFTU", "LHRDEL", "SREABC", "RLKZUN", "ZUNRLK"]        }    df = pd.DataFrame(data)df['ORD']=df['Origin]+df['Destination']

I wan to create a coumn of Market_Id like this from the dataToy example

The ORD for 1st riw of the ORD column is DELLHR and the 5th row is LHRDEL. However, the Market_ID is DELLHR for both.Help me code this.


Viewing all articles
Browse latest Browse all 23131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>