Skip to content

Pandas Basics

Review the Pandas documentation, if not proficient, and more specifically the following concepts of Series and DataFrames and DataFrame Extensions.

What is a Pandas Series and DataFrame?

  1. Pandas Series
  2. Pandas DataFrame
  3. Pandas DataFrame Extension

Series vs DataFrame Column Count

  • A Pandas Series returns a single column.
  • A Pandas DataFrame returns multiple column.



Properties#

The "ta" extension has some optional properties that may be of use when using ohlcv data.




adjusted#

Get/Set the adjusted_close column.

Mode:

  • Get: The adjusted column as str.
  • Set: The column name, to set as the adjusted column. Default: None




config#

Get/Set the configuration file path.

Mode:

  • Get: The path of the config file as str. Default: "~/.config/pandas-ta/settings.json"
  • Set: The path to the config file.


NOTICE

Thanks to all those that have sponsored and dontated to the library in the past! Your support has been greatly appreciated! 🙏

However, future releases are on definite hold until 100+ donations of $150+ have been received via Buy Me a Coffee.

Help keep this library and application the best in it's class!




cores#

Manage the number of cpus to utilize for multiprocessing.

Mode:

  • Get: The number of cores for multiprocessing as Int.
  • Set: The number of cores Default: None

Disable multiprocessing

Set: df.ta.cores = 0

Multiprocessing caveats

  • Multiprocessing will not work when using the following keys: "col_names".
  • Multiprocessing may not work or complete as expected when indicator chaining.
    • Chained indicators use non-default, ohlcv, sources as input Series.




exchange#

A label property of the major exchange the ohlcv data is associated with.

Mode:

  • Get: The exchange as a str.
  • Set: The exchange. Must be one of the following ta.EXCHANGE_TZ.keys(). Default: "NYSE"




time_range#

Useful for annualization.

Mode:

  • Get: Time elapsed between the first and last DateTemeIndex as float.
  • Set: Default: "years"

See Also

  • Options: "months", "weeks", "days", "hours", "minutes" and "seconds". Default: "years".


NOTICE

Thanks to all those that have sponsored and dontated to the library in the past! Your support has been greatly appreciated! 🙏

However, future releases are on definite hold until 100+ donations of $150+ have been received via Buy Me a Coffee.

Help keep this library and application the best in it's class!




Methods#

categories

List of categories.

Returns:

Type Description
ListStr

List of the indicator categories.




constants

Concatenate / Drop constant(s) to the DataFrame.

Parameters:

Name Type Description Default
append bool

Concatenate if True. Drop if False. Default: None

required
values Array

List/Numpy array of values to append/drop from the DataFrame.

required

Returns:

Type Description
(Series, DataFrame, None)

Depends upon parameters.

See Also




datetime_ordered

DataFrame DateTime ordered?

Returns:

Type Description
bool

True if the DataFrame is DateTime ordered, otherwise False.




help

Help!

Parameters:

Name Type Description Default
s str

String to search for. Default: ""

''

Returns:

Type Description
None | TextIO

Opens web browser to relevant Pandas TA website page or prints all search keywords.




indicators

List indicators.

Parameters:

Name Type Description Default
as_list bool

Return as a list. Default: False

None
exclude ListStr

The passed in list will be excluded from the indicators list. Default: None

None

Returns:

Type Description
TextIO | ListStr

Prints list or returns a ListStr.




last_run

Detailed string of last run time.

Returns:

Type Description
str

Detailed date and time of the lastest run.




reverse

Reverse the DataFrame inplace.

Returns:

Type Description
None

DataFrame reversed inplace.




study

Applies the ta listed in a Study.

Other Parameters:

Name Type Description
chunksize int

Multiprocessing Pool chunksize. Default: df.ta.cores

cores int

Number of Multiprocessing cores. Default: df.ta.cores

exclude ListStr

List of indicator names. Default: []

ordered bool

Run ta in order. Default: True

returns bool

Return the DataFrame. Default: False

timed bool

Print the process time. Default: False

verbose bool

More verbose output. Default: False

Multiprocessing

Multiprocessing is not viable or efficient for some cases. Testing is required per case. See Multiprocessing for more information.




ticker

Download Historical ohlcv data as a Pandas DataFrame if yfinance package is installed. It also can run a ta.Study afterwards.

Parameters:

Name Type Description Default
ticker str

Any string for a ticker you would use with yfinance. Default: "SPY"

None
period str

See the yfinance history() method for more options. Default: "max"

None
interval str
None
study Study | str

After downloading, apply Study Default: None

None
proxy dict

Proxy dictionary. Default: {}

None
timed bool

Print download time to stdout. Default: False

False

Returns:

Type Description
DataFrame | None

ohlcv df or None

YFinance history parameters
Example
import panadas as pd
import pandas_ta as ta

# Simple
df = pd.DataFrame().ta.ticker("SPY", period="2y", timed=True)

# Built In Study
df = pd.DataFrame().ta.ticker("SPY", period="2y", study=ta.AllStudy, timed=True)




to_utc

Set the DataFrame index to UTC.

Returns:

Type Description
None

Performs the operation.


"Buy Me A Coffee"

ko-fi