cancel
Showing results for 
Search instead for 
Did you mean: 

regarding the use of libraries in python operator in sap datahub

0 Kudos

I am trying to use the python operator to do some basic data manipulation while reading the csv file from amazon s3 .I tried to read the file using pandas library but it is throwing encoding error.I tried a lot but decoding did not work for me. I hope the attached image would give a clearer picture.Thanks in Advance.

Accepted Solutions (0)

Answers (1)

Answers (1)

AndreasForster
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Vikas, Here is some code that is working for me in a Python 3 operator. Very similar setup to yours, CSV file is in S3, the Real File operator brings it into the pipeline. (any reason you are using Python 2 by the way?)

The encoding will depend on your own file I suppose. If this code is not working for you, testing the Python code and encoding outside Data Hub might help

def on_input(data):
import pandas as pd
import io
df_data = pd.read_csv(io.StringIO(data), sep=";")