Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to use group by in python to get 15 mins candle data from 1 min candle

df = pd.read_csv("filename.csv", parse_dates = [["DATE", "TIME"]], index_col=0)
Comment

how to use group by in python to get 15 mins candle data from 1 min candle

df.head()
Out[7]: 
                       OPEN    HIGH     LOW   CLOSE  VOLUME 
DATE_TIME                                                   
1997-02-03 09:04:00  3046.0  3048.5  3046.0  3047.5      505
1997-02-03 09:05:00  3047.0  3048.0  3046.0  3047.0      162
1997-02-03 09:06:00  3047.5  3048.0  3047.0  3047.5       98
1997-02-03 09:07:00  3047.5  3047.5  3047.0  3047.5      228
1997-02-03 09:08:00  3048.0  3048.0  3047.5  3048.0      136
Comment

how to use group by in python to get 15 mins candle data from 1 min candle

df.resample("5T").mean()
Out[8]: 
                       OPEN    HIGH     LOW   CLOSE  VOLUME 
DATE_TIME                                                   
1997-02-03 09:00:00  3046.0  3048.5  3046.0  3047.5    505.0
1997-02-03 09:05:00  3047.6  3047.9  3046.8  3047.3    159.6
1997-02-03 09:10:00  3045.6  3045.9  3044.8  3045.0    110.2
1997-02-03 09:15:00  3043.6  3044.0  3042.8  3043.2     69.2
1997-02-03 09:20:00  3044.7  3045.2  3044.5  3045.0     65.8
1997-02-03 09:25:00  3043.8  3044.0  3043.5  3043.7     59.0
1997-02-03 09:30:00  3044.6  3045.0  3044.3  3044.6     56.0
1997-02-03 09:35:00  3044.5  3044.5  3043.5  3044.5     44.0
Comment

PREVIOUS NEXT
Code Example
Python :: required depend filed odoo 
Python :: file = Root() path = file.fileDialog() print("PATH = ", path) 
Python :: without @tf.function OOM 
Python :: print [url_string for extension in extensionsToCheck if(extension in url_string)] 
Python :: fizz buzz python 
Python :: selenium text value is empty in flask returns 
Python :: taggablemanager serializer django 
Python :: python force realod 
Python :: command to upgrade the pip 
Shell :: how to check laptop serial number in ubuntu 
Shell :: restart apache ubuntu 
Shell :: install handbrake ubuntu 
Shell :: uninstall skype from ubuntu 
Shell :: how to uninstall spacevim 
Shell :: remove identifier files wsl2 
Shell :: git config username and password global 
Shell :: git list user and email 
Shell :: logstash is not listening on ip address 
Shell :: npm show registry 
Shell :: copy ssh key ubuntu 
Shell :: uninstall npm ubuntu 
Shell :: The requested apache plugin does not appear to be installed 
Shell :: command to update vlc in ubuntu 
Shell :: rename computer ubuntu 20.04 
Shell :: apache enable mod reqrite 
Shell :: remove stopped containers 
Shell :: cannot be loaded because running scripts is disabled on this system. 
Shell :: git delete local branch except master 
Shell :: uninstall foxit reader ubuntu 18.04 
Shell :: check firewall centos 7 
ADD CONTENT
Topic
Content
Source link
Name
5+3 =