mirror of
				https://github.com/blakeblackshear/frigate.git
				synced 2025-10-27 10:52:11 +01:00 
			
		
		
		
	Explicitly set pandas dtype to reduce memory usage and fix warning (#11145)
* Explicitly set dtype to reduce memory usage and fix warning * remove extra line
This commit is contained in:
		
							parent
							
								
									90468c8bf5
								
							
						
					
					
						commit
						5858eee1fe
					
				@ -440,6 +440,7 @@ def motion_activity():
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    # resample data using pandas to get activity on scaled basis
 | 
					    # resample data using pandas to get activity on scaled basis
 | 
				
			||||||
    df = pd.DataFrame(data, columns=["start_time", "motion", "camera"])
 | 
					    df = pd.DataFrame(data, columns=["start_time", "motion", "camera"])
 | 
				
			||||||
 | 
					    df = df.astype(dtype={"motion": "float16"})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # set date as datetime index
 | 
					    # set date as datetime index
 | 
				
			||||||
    df["start_time"] = pd.to_datetime(df["start_time"], unit="s")
 | 
					    df["start_time"] = pd.to_datetime(df["start_time"], unit="s")
 | 
				
			||||||
@ -517,6 +518,7 @@ def audio_activity():
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    # resample data using pandas to get activity on scaled basis
 | 
					    # resample data using pandas to get activity on scaled basis
 | 
				
			||||||
    df = pd.DataFrame(data, columns=["start_time", "audio"])
 | 
					    df = pd.DataFrame(data, columns=["start_time", "audio"])
 | 
				
			||||||
 | 
					    df = df.astype(dtype={"audio": "float16"})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # set date as datetime index
 | 
					    # set date as datetime index
 | 
				
			||||||
    df["start_time"] = pd.to_datetime(df["start_time"], unit="s")
 | 
					    df["start_time"] = pd.to_datetime(df["start_time"], unit="s")
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user