Reader small image

You're reading from  Python Algorithmic Trading Cookbook

Product typeBook
Published inAug 2020
Reading LevelIntermediate
PublisherPackt
ISBN-139781838989354
Edition1st Edition
Languages
Right arrow
Author (1)
Pushpak Dagade
Pushpak Dagade
author image
Pushpak Dagade

Pushpak Dagade is working in the area of algorithmic trading with Python for more than 3 years. He is a co-founder and CEO of AlgoBulls, an algorithmic trading platform.
Read more about Pushpak Dagade

Right arrow

Creating a DataFrame from other formats

In this recipe, you will create DataFrame objects from other formats, such as .csv files, .json strings, and pickle files. A .csv file created using a spreadsheet application, valid JSON data received over web APIs, or valid pickle objects received over sockets can all be processed further using Python by converting them to DataFrame objects.

Loading pickled data received from untrusted sources can be unsafe. Please use read_pickle() with caution. You can find more details here: https://docs.python.org/3/library/pickle.html. If you are using this function on the pickle file created in the previous recipe, it is perfectly safe to use read_pickle().

Getting ready

Make sure you have followed the previous recipe before starting this recipe.

How to do it…

Execute the following steps for this recipe:

  1. Create a DataFrame object by reading a CSV file:
>>> pandas.read_csv('dataframe.csv')

We get the following output:

         ...
lock icon
The rest of the page is locked
Previous PageNext Chapter
You have been reading a chapter from
Python Algorithmic Trading Cookbook
Published in: Aug 2020Publisher: PacktISBN-13: 9781838989354

Author (1)

author image
Pushpak Dagade

Pushpak Dagade is working in the area of algorithmic trading with Python for more than 3 years. He is a co-founder and CEO of AlgoBulls, an algorithmic trading platform.
Read more about Pushpak Dagade