안녕하세요 저는 IBM Bluemix를 사용하고 있습니다. 여기서는 Apache Spark 노트북을 사용하고 있으며 dashDB에서 데이터를로드 중입니다. 시각화를 제공하려고하는데 행이 표시되지 않습니다. 내가이 명령을 사용하면python 노트북에서 pandas를 사용하는 방법 (dashDB의 데이터)
def get_file_content(credentials):
from pyspark.sql import SQLContext
sqlContext = SQLContext(sc)
props = {}
props['user'] = credentials['username']
props['password'] = credentials['password']
# fill in table name
table = credentials['username'] + "." + "BATTLES"
data_df=sqlContext.read.jdbc(credentials['jdbcurl'],table,properties=props)
data_df.printSchema()
return StringIO.StringIO(data_df)
는 :
data_df.take(5)
을 나는 열과 행 모두 데이터의 처음 5 행의 정보를 얻을 수 있습니다. 하지만이 수행 할 때
content_string = get_file_content(credentials)
BATTLES_df = pd.read_table(content_string)
내가 얻을이 오류 :
ValueError: No columns to parse from file
그리고 내가 볼 때 다음 .head()
또는 .tail()
에만 열 이름이 표시됩니다.
여기에 가능한 문제가있는 사람이 있습니까? 파이썬에 대한 지식이 매우 부족합니다. 제발 고마워.