0

I am trying to add 4 columns from a database in excel, 2 of those columns must be filtered and I am trying with "usecols" but it does not work, is there any other way to select specific data?

df = pd.read_excel('BD_completa.xlsx', sheet_name='Hoja1', usecols=['[Fecha Orden Compra]','precio_del_bien','[Código Artículo]'==32, '[Código Rubro]'==2])

and i have the next error:

ValueError: 'usecols' must either be list-like of all strings, all unicode, all integers or a callable.

Suirebil
  • 1
  • 1
  • 1
    Welcome to StackOverflow. Please take the [tour](https://stackoverflow.com/tour) and learn [How to Ask](https://stackoverflow.com/help/how-to-ask). In order to get help, you will need to provide a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example). If your question concern a pandas dataframe, then learn how to make a [reproducible pandas example](https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples) – alec_djinn Sep 11 '22 at 17:50
  • What is `'[Código Artículo]'==32` meant to do? The issue is that your `usecols` list contains a mixture of strings and boolean values, which is invalid. – sj95126 Sep 11 '22 at 19:28

0 Answers0