获得FutureWarning:运行python代码时逐元素比较失败错误

时间:2019-11-13 09:59:26

标签: python python-2.7

我正在尝试在python脚本下运行。 我出错了。我竭尽全力解决这个问题。

通常不会出现这种问题。我尝试了警告模块。 请指导我如何解决这个问题。

你能帮我吗?

python脚本:

import pandas as pd
import subprocess
import sys
import warnings
import os
import time
import datetime
import pwd
import logging
import uuid
import boto3
import pandas as pd
import csv
import pwd
import numpy as np
from boto3.s3.transfer import S3Transfer
from parameter_file_input import *
#warnings.simplefilter(action='ignore', category=FutureWarning)
file_to_df = '/home/hadoop/medaff/Metadata/Join_metadata.txt'
def join_condition(TableName):
    meta_df = pd.read_csv(file_to_df, delimiter='|')
    #meta_df.set_index(['0'], inplace=True)
    meta_df = meta_df[meta_df['TableName']==TableName]
    if meta_df.empty == True:
        return ''
    seq_max = int(meta_df['Sequnce'].max())
    query = ''
    print(query)
    for i in range(1, seq_max+1):
        counter = 0
        meta_df_temp = meta_df[meta_df['Sequnce'] == i]
        for index,row in meta_df_temp.iterrows():
            query+=' '
            print(query)
            if pd.isna(row['operator']):
                print("Operator Null")
                if counter==0:
                    if pd.isna(row['Aliastable']):
                        print("Aliastable Null")
                        query += row['jointype']+' '+row['Childtable']+' on ('+row['Parenttable']+'.'+row['columnname']+'='+row['Childtable']+'.'+row['child column']+' and '
                    else:
                        print("Aliastable not Null")
                        query += row['jointype']+' '+row['Aliastable']+' '+row['Childtable']+' on ('+row['Parenttable']+'.'+row['columnname']+'='+row['Childtable']+'.'+row['child column']+' and '
                else:
                    query += row['Parenttable']+'.'+row['columnname']+'='+row['Childtable']+'.'+row['child column']+' and '
            else:
                print("Operator not Null")
                if counter==0:
                    if pd.isna(row['Aliastable']):
                        print("Aliastable Null")
                        query += row['jointype']+' '+row['Childtable']+' on ('+row['Parenttable']+'.'+row['columnname']+' '+row['operator']+' '+row['Childtable']+'.'+row['child column']+' and '
                    else:
                        print("Aliastable not Null")
                        query += row['jointype']+' '+row['Aliastable']+' '+row['Childtable']+' on ('+row['Parenttable']+'.'+row['columnname']+' '+row['operator']+' '+row['Childtable']+'.'+row['child column']+' and '
                else:
                    query += row['Parenttable']+'.'+row['columnname']+' '+row['operator']+' '+row['Childtable']+'.'+row['child column']+' and '
            counter+=1
        counter = 0
        query = query[:0-len(' and ')]+')'
        query = query.lstrip(')')
    return query
print(join_condition('TERR'))

错误:

/home/hadoop/.local/lib/python2.7/site-packages/pandas/core/ops.py:1649: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
  result = method(y)

0 个答案:

没有答案