Home:ALL Converter>Python error : TypeError at / unsupported operand type(s) for &: 'float' and 'bool'

Python error : TypeError at / unsupported operand type(s) for &: 'float' and 'bool'

Ask Time:2022-03-16T00:55:51         Author:francine

Json Formatter

Good morning all ! I come to ask for your support. I'm trying to make a selection on the data in my dataframe and since then I'm getting an error. I'm new to Python and I'm stuck on an error that's taking me a long time. Below is my code:

if requete.method == 'POST':
    myfile = requete.FILES['file']
    fs = FileSystemStorage()
    filename = fs.save(myfile.name, myfile)
    uploaded_file_url = fs.url(filename)
    df = pd.read_csv(os.path.join(MEDIA_ROOT, filename), sep=";", encoding='unicode_escape')
    array = [
        'Bundle_Weekly_400MB', 'Bundle_Daily_40MB', 
        'Bundle_Daily_150MB', 'Bundle_Daily_10MB', 'Bundle_Weekly_100MB',
    df = df.loc[df['EXTERNAL_DATA1'] == 'dataBundle'] & df.loc[df['EXTERNAL_DATA2'].isin(array)]

Below is the error I got:

enter image description here

Author:francine,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/71486101/python-error-typeerror-at-unsupported-operand-types-for-float-and-bo