Automating the Extraction of CSV files from layers

162
0
04-11-2024 01:53 PM
Labels (1)
saylwin
New Contributor

Hello! I am fairly new to both pandas AND ArcGIS online notebooks. I am working on a project that requires me to make a dataframe using pandas, alter it to change formatting like column names and change dates from date and time to just MM/DD/YYY. I trialed out the changes that I wanted to make using a csv file that I extracted in a Jupyter environment, but now I want to bring it into ArcGIS Online notebooks to work with the layer, that is constantly having more and more data added to it. 

I am going to integrate this into a loop, however there are a few things that I am unsure of. I do not know how to make it so that it either extracts the df into a csv file on a monthly basis, only including the most updated data. I am also unsure of the best way to go about this in the notebook environment with the integration of my layer! Any help is greatly appreciated.

 

TRIALDATAFRAME = pd.read_csv('TRIALCSVFILE.csv') #read csv file into df
relevantcolumns = ['Latitude','Longitude','Date and Time','Species','GlobalID'] #establish columns that are needed
updateddf= TRIALDATAFRAME[relevantcolumns] #make df with ONLY needed columns
updateddf.insert(5,'informationWithheld','y') #insert new column, value will be the same for all of them
updateddf.insert(6,'basisOfRecord','HumanObservation') #same as above
updateddf.columns = ['decimalLatitude','decimalLongitude','eventDate','scientificName','occurenceID','informationWithheld','basisOfRecord'] #change column names to be complient with data standards
updateddf.loc[:, 'eventDate']=gbifcolumns['eventDate'].str.split(' ').str[0] #change date and time to just data

 

 

Tags (3)
0 Kudos
0 Replies