I have information on total number of rows and number of columns for a new pandas dataframe
import pandas as pd
nRow = 10
nCol = 4
Based on this information I want to create a new dataframe where each element will be filled by 1
Is there any direct method available with pandas to achieve this?
Another possible solution, which uses np.ones to create an array of ones with which to create the wanted dataframe:
pd.DataFrame(np.ones((nRow,nCol)))
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With