Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from itertools import zip_longest
- import itertools
- import pandas
- import numpy as np
- import matplotlib.pyplot as plt
- all_trades = pandas.read_csv('./ccmx18hf .csv', parse_dates={'Date': [0,1]}, index_col=0, encoding = 'unicode_escape')
- print (all_trades.head())
- volume = (all_trades['quant_total'])
- print(volume.head())
- trades = (all_trades['preco_ordem'])
- def cleanup(x):
- if isinstance(x, str) and 'e-' in x:
- return 0
- else:
- return float(x)
- volume = volume.apply(lambda x: cleanup(x))
- volume = volume.astype(np.float32)
- order_side pre�o_ordem quant_total quant_neg status
- Date
- 02/07/2018 08:58:25 Sell 39,36 4 0.0 New
- 02/07/2018 08:59:53 Sell 40 1 0.0 New
- 02/07/2018 08:59:56 Sell 39,93 1 0.0 New
- 02/07/2018 09:00:22 Buy 39,1 10 0.0 New
- 02/07/2018 09:00:26 Buy 39,11 1 0.0 New
- Date
- 02/07/2018 08:58:25 4
- 02/07/2018 08:59:53 1
- 02/07/2018 08:59:56 1
- 02/07/2018 09:00:22 10
- 02/07/2018 09:00:26 1
- Name: quant_total, dtype: int64
- Traceback (most recent call last):
- File "/home/operacao/miniconda2/envs/py3env/lib/python3.7/site-packages/pandas/core/indexes/base.py", line 2657, in get_loc
- return self._engine.get_loc(key)
- File "pandas/_libs/index.pyx", line 108, in pandas._libs.index.IndexEngine.get_loc
- File "pandas/_libs/index.pyx", line 132, in pandas._libs.index.IndexEngine.get_loc
- File "pandas/_libs/hashtable_class_helper.pxi", line 1601, in pandas._libs.hashtable.PyObjectHashTable.get_item
- File "pandas/_libs/hashtable_class_helper.pxi", line 1608, in pandas._libs.hashtable.PyObjectHashTable.get_item
- KeyError: 'preco_ordem'
- During handling of the above exception, another exception occurred:
- Traceback (most recent call last):
- File "ccmx.py", line 15, in <module>
- trades = (all_trades['preco_ordem'])
- File "/home/operacao/miniconda2/envs/py3env/lib/python3.7/site-packages/pandas/core/frame.py", line 2927, in __getitem__
- indexer = self.columns.get_loc(key)
- File "/home/operacao/miniconda2/envs/py3env/lib/python3.7/site-packages/pandas/core/indexes/base.py", line 2659, in get_loc
- return self._engine.get_loc(self._maybe_cast_indexer(key))
- File "pandas/_libs/index.pyx", line 108, in pandas._libs.index.IndexEngine.get_loc
- File "pandas/_libs/index.pyx", line 132, in pandas._libs.index.IndexEngine.get_loc
- File "pandas/_libs/hashtable_class_helper.pxi", line 1601, in pandas._libs.hashtable.PyObjectHashTable.get_item
- File "pandas/_libs/hashtable_class_helper.pxi", line 1608, in pandas._libs.hashtable.PyObjectHashTable.get_item
- KeyError: 'preco_ordem'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement