0

I have a dataframe with 85 columns and something like 10.000 rows.
The first column is Shrt_Desc and the last Refuse_Pct
The new data frame that I want has to have Shrt_Desc, then leave some columns out and then include in series Fiber_TD_(g) to Refuse_Pct
I use:

dfi_3 = food_info.loc[:, ['Shrt_Desc', 'Fiber_TD_(g)':'Refuse_Pct']] 

but it gives a syntax error. Any ideas how can I achieve this?
Thank you.

Jason Cole
  • 50
  • 8
Paradigm
  • 149
  • 1
  • 2
  • 10

1 Answers1

0

Borrowing the main idea from this answer:

pd.concat([food_info['Shrt_Desc'], food_info.ix[:, 'Fiber_TD_(g)':]], axis=1) 
Community
  • 1
  • 1
IanS
  • 15,771
  • 9
  • 60
  • 84