How to convert binary file to pandas dataframe

0

I use Amazon Sagemaker for model training and prediction. I have a problem with the returned data with predictions. I am trying to convert prediction data to pandas dataframe format.

After the model is deployed:

from sagemaker.serializers import CSVSerializer xgb_predictor=estimator.deploy( initial_instance_count=1, instance_type='ml.g4dn.xlarge', serializer=CSVSerializer() )

I made a prediction on the test data:

predictions=xgb_predictor.predict(first_day.to_numpy())

But, returned prediction results are in a binary file. This is a sample returned predictions:

b'2.092024326324463\n10.584211349487305\n18.23127555847168\n2.092024326324463

How can I convert prediction data to pandas dataframe?

질문됨 2년 전1146회 조회
1개 답변
0

Hi!

It looks like you have a bytes response, have a look at this post, this will help you with the transform to dataframe.

Hope it helps :)

AWS
Dani M
답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠