'How can I save the output from a subprocess to a dataframe?
I'm working on a script to extract exif data (Latitude, Longitude, and Altitude) from RTK drone images. I have more or less copied the code below from a youtube video (Franchyze923)- with a few modifications. [I've been coding for a very short time]. How can I get the results of the subprocess to save to a table/dataframe (eventually I want to save the information to a .csv).
A different version of this script generated a .csv for every image - which I then imported all the csv files and pd.concat() them into one dataframe. That works but seems clunky.
import os
import subprocess
#Extracting exif data for images in Agisoft folder
exiftool_location = #path to exiftool.exe
images_to_extract_exif = #path to images
for path, directories, files in os.walk(images_to_extract_exif):
for images_to_extract_exif in files:
if images_to_extract_exif.endswith("JPG"):
full_jpg_path = os.path.join(path, images_to_extract_exif)
exiftool_command = [exiftool_location, "-filename", "-gpslatitude", "-gpslongitude", "-gpsaltitude", "-T", "-n", full_jpg_path]
subprocess.run(exiftool_command)
The output from the code looks great - I just have no clue how to save it to a table/dataframe.
DJI_0001.JPG 45.2405341666667 -95.3808298055556 354.427
DJI_0002.JPG 45.2405253333333 -95.3808253055556 354.434
DJI_0003.JPG 45.2404568888889 -95.3808200277778 354.447
DJI_0004.JPG 45.2403695277778 -95.3808205555556 354.431
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
