Read and Write CSV Files in Python Directly From the Cloud

  .gist table { margin-bottom: 0; } We’ll make this into a function so we can easily use it later: .gist table { margin-bottom: 0; } Adding files to IBM Cloud Object Storage with Python IBM Cloud Object Storage’s web interface makes it easy to add new objects to your buckets, but at some point you will probably want to handle creating objects through Python programmatically..The put_object method allows you to do this..In order to use it you will need: The name of the bucket you want to add the object to; A unique name (Key) for the new object; A bytes-like object, which you can get from: urllib‘s request.urlopen(…).read() method, e.g..urllib.request.urlopen( Python’s built-in open method in binary mode,, rb) To demonstrate, let’s add another CSV file to our bucket..This time we’ll use FiveThirtyEight’s airline safety dataset…gist table { margin-bottom: 0; } You can now easily access your newly created object using the function we defined above in the Reading from Object Storage using Python section…gist table { margin-bottom: 0; } Get 10 Terabytes of IBM Cloud Object Storage for free You now know how to read from and write to IBM Cloud Object Storage using Python!.Well done..The ability to pragmatically read and write files to the Cloud will be quite handy when working from scripts and Jupyter notebooks..If you build applications or do data science, we also have a great offer for you..You can apply to become an IBM Partner at no cost to you and receive 10 Terabytes of space to play and build applications with.. More details

Leave a Reply