python - 运行 python 代码时出现 FutureWarning: elementwise comparison failed 错误
问题描述
我正在尝试在 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)
解决方案
推荐阅读
- r - 根据存储在列中的值创建新行
- ldap - 为什么 Apacheds 不导入在 ldif 文件中设置了 top 属性的用户?
- r - R,参数意味着不同的行数
- database - 为什么 tableName 的 liquibase 引用停止工作?
- c# - 在 C# 中将文件另存为 .ps1
- c# - 在 ASP.NET Core MVC 中修改用户数据
- clickonce - 如何在多个环境中更改 ClickOnce 的桌面图标
- ios - 应用程序进入后台时如何停止 AirPlay 媒体暂停
- c - 如何在 Visual Studio 2019 中对 C 语言进行语法检查和格式化代码?
- html - 在 gmail 中显示的锚标签