Skip to content

Tag: pandas

how can i write comments on some cells of excel sheet using pandas

I didn’t find anything that enable me to write comments on some specific cell while writing excel sheet using panadas.to_excel . Any help is appreciated. Answer After searching for some time, I think the best way to handle comments or other such properties like color and size of text at cell or sheet le…

Pandas row to json

I have a dataframe in pandas and my goal is to write each row of the dataframe as a new json file. I’m a bit stuck right now. My intuition was to iterate over the rows of the dataframe (using df.iterrows) and use json.dumps to dump the file but to no avail. Any thoughts? Answer Pandas DataFrames have a …

Python fast DataFrame concatenation

I wrote a code to concatenate parts of a DataFrame to the same DataFrame as to normalize the occurrence of rows as per a certain column. and this is unbelievably slow. Is there a way to fast concatenate DataFrame without creating copies of it? Answer There are a couple of things that stand out. To begin with,…