I have a dataframe called "wheat_cities"
The columns in my dataframe are as follows
"Date" "Wheat..Maximum.Price"
[3] "Wheat..Minimum.Price" "Wheat..Modal.Price"
[5] "Wheat..North.Zone..Agra" "Wheat..North.Zone..Amritsar"
[7] "Wheat..North.Zone..Bhatinda" "Wheat..North.Zone..Chandigarh"
[9] "Wheat..North.Zone..Dehradun" "Wheat..North.Zone..Delhi"
[11] "Wheat..North.Zone..Gurgaon" "Wheat..North.Zone..Haldwani"
[13] "Wheat..North.Zone..Hisar" "Wheat..North.Zone..Jammu"
[15] "Wheat..North.Zone..Kanpur" "Wheat..North.Zone..Karnal"
[17] "Wheat..North.Zone..Lucknow" "Wheat..North.Zone..Ludhiana"
[19] "Wheat..North.Zone..Mandi" "Wheat..North.Zone..Panchkula"
[21] "Wheat..North.Zone..Shimla" "Wheat..North.Zone..Srinagar"
[23] "Wheat..North.Zone..Varanasi" "Wheat..West.Zone..Ahmedabad"
[25] "Wheat..West.Zone..Bhopal" "Wheat..West.Zone..Bhuj"
[27] "Wheat..West.Zone..Gwalior" "Wheat..West.Zone..Indore"
[29] "Wheat..West.Zone..Jabalpur" "Wheat..West.Zone..Jaipur"
[31] "Wheat..West.Zone..Jodhpur" "Wheat..West.Zone..Kota"
[33] "Wheat..West.Zone..Mumbai" "Wheat..West.Zone..Nagpur"
[35] "Wheat..West.Zone..Panaji" "Wheat..West.Zone..Raipur"
[37] "Wheat..West.Zone..Rajkot" "Wheat..West.Zone..Rewa"
[39] "Wheat..West.Zone..Sagar" "Wheat..West.Zone..Surat"
[41] "Wheat..East.Zone..Bhagalpur" "Wheat..East.Zone..Bhubaneshwar"
[43] "Wheat..East.Zone..Cuttack" "Wheat..East.Zone..Patna"
[45] "Wheat..East.Zone..Purnia" "Wheat..East.Zone..Ranchi"
[47] "Wheat..East.Zone..Rourkela" "Wheat..East.Zone..Sambalpur"
[49] "Wheat..East.Zone..Siliguri" "Wheat..North.East.Zone..Aizwal"
[51] "Wheat..North.East.Zone..Dimapur" "Wheat..North.East.Zone..Guwahati"
[53] "Wheat..North.East.Zone..Itanagar" "Wheat..North.East.Zone..Shillong"
[55] "Wheat..South.Zone..Bengaluru" "Wheat..South.Zone..Chennai"
[57] "Wheat..South.Zone..Coimbatore" "Wheat..South.Zone..Dharwad"
[59] "Wheat..South.Zone..Dindigul" "Wheat..South.Zone..Ernakulam"
[61] "Wheat..South.Zone..Hyderabad" "Wheat..South.Zone..Karimnagar"
[63] "Wheat..South.Zone..Kozhikode" "Wheat..South.Zone..Mangalore"
[65] "Wheat..South.Zone..Mysore" "Wheat..South.Zone..Palakkad"
[67] "Wheat..South.Zone..Port.Blair" "Wheat..South.Zone..Puducherry"
[69] "Wheat..South.Zone..Thiruchirapalli" "Wheat..South.Zone..Thiruvananthapuram"
[71] "Wheat..South.Zone..Thrissur" "Wheat..South.Zone..Tirunelveli"
[73] "Wheat..South.Zone..Vijaywada" "Wheat..South.Zone..Visakhapatnam"
[75] "Wheat..South.Zone..Warangal" "Wheat..South.Zone..Wayanad"
>
I want to change the column names such that for column 5-76, I just get the name after the second "..". For column 2 and 3, I get the name after the first ".."
Since the length of characters differs, I am unable to use the substring command.
Please help. Thanks in advance!