I am a beginner in python. I have a csv file, in which I need to do some modification and then get the output as dbf file. (which can be opened in foxpro). Can somebody guide? I want to get this dph1 dataframe into dbf. I did some searching and found that pysal might do the trick. But how?
import pandas as pd
Read the CSV file into a DataFrame
dph1 = pd.read_csv(r”C:UsersSouvikDownloadsADEE.csv”)
Remove extra white spaces at the end of each column
dph1 = dph1.applymap(lambda x: x.strip() if isinstance(x, str) else x)
Drop rows where all values are blank
dph1.dropna(how=’all’, inplace=True)
Order the DataFrame
dph1.sort_values(by=[‘dsl’], inplace=True)
Souvik Maitra is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.