How to write a tabular file in an instance of the Azure Data Lake Store with the Python API?

0

Suppose I have an instance of the Data Lake Store in my Azure subscription and I'd like to create a Python script to write a tabular file with a separator (of type CSV or similar) in that instance.

Without considering the Spark API, how can I do this to write this tabular file in the Data Lake Store instance using the Python API to write files?

    
asked by anonymous 04.12.2018 / 22:38

1 answer

0

I do not use Azure, so please forgive me if it's not relevant: I'll answer how to write data to a CSV file using Python3.x.

It is worth mentioning before that most libraries include a method to convert to CSV directly, such as Pandas and the Numpy . Possibly (I'm speculating, yes) you can redirect your data in Python back to the Azure environment and use a native tool.

A simple example of how to write a CSV file, using Python:

import csv
lista = ['Alice','Bob','Carlos']
lista2 = ['Xavier','Yago','Zulmira']

with open('nomes.csv', 'w', newline='') as csvfile:
    namewriter = csv.writer(csvfile)
    namewriter.writerow(lista)
    namewriter.writerow(lista2)

    
04.12.2018 / 23:06