0

I have created tuples before like this:

list(zip(df['Column1'],df['Column2']))

But when I do this, it doesn't work.

    Lane    Carrier Scac    Cust Linehaul_2022Q2    Cust Linehaul_2022Q3    Cust Linehaul_2022Q4    Load Number_2022Q2  Load Number_2022Q3  Load Number_2022Q4
0   ADELANTO, CA - BLOOMINGTON, CA  RDWY    0.0 105.9   0.0 0   1   0
1   ALACHUA, FL - LITHIA SPRINGS, GA    MGXB    0.0 1603.0  0.0 0   1   0
2   ALACHUA, FL - LITHIA SPRINGS, GA    RDWY    101.3   105.1   0.0 1   1   0

list(zip(df_SO['Cust Linehaul_2022Q2'],df_SO['Cust Linehaul_2022Q3']))

TypeError: 'Index' object is not callable

I learnt that way to make a tuple from this thread: How do I iterate through two lists in parallel?

But not sure why this one is identifying as an index and not a series.

pmqs
  • 3,066
  • 2
  • 13
  • 22
  • 4
    The likely problem here is that you created your own variable called `list` which is of type `Index`. This is why we advise over and over and over not to create variables with names that echo the Python types. – Tim Roberts Jan 05 '23 at 20:36
  • Indeed it was left hanging there. Sorry for that. Thanks. – Rajib Lochan Sarkar Jan 05 '23 at 20:47

0 Answers0