title: python code to generate a sine wave with diffferent points and different frequencies
body: <p>The requirement is to generate a sine wave with frequencies ranging from 1 Hz to 10 Hz.</p>
  <p>The conditions are</p>
  <ol>
  <li>The amplitude is one volt for all sine wave frequencies</li>
  <li>The 1 Hz signal must be sampled into 100 wave points.</li>
  <li>Similarly 2 Hz signal must be sampled into 200 samples per second and 3 Hz signal must be sampled into 300 samples per second and 4 Hz signal to 400 samples/sec and so on up to 10 Hz.</li>
  </ol>
  <p>4.All these values must be written into Csv file and also converted to excel file.</p>
  <p>Thus excel has 10 columns named 1 Hz to 10 Hz. and each column have values accordingly.</p>
  <p>1st column has values of 100 samples
  2nd column has values of 200 samples and so on up to 10th column.</p>
  <p>can anyone help to solve this. I coded for 1 Hz to 10 Hz with same sampling ratio and with all columns with same number of rows.</p>
  <pre><code>import numpy as np
  import pandas as pd
  def get_values_for_frequency(freq):
      # sampling information
      Fs = 100    #sample rate- no of samples per second
      T = 1/Fs    #sampling period   %sample per second
      t = 1       #seconds of sampling
      N = Fs*t    #total points in signal
      # signal information
      omega = 2*np.pi*freq # angular frequency for sine waves
      t_vec = np.arange(N)*T # time 
      y = np.sin(omega*t_vec) #sine wave generation
      return y
  #columns are created for sine wave frequencies
  df = pd.DataFrame(columns =['1Hz','2Hz', '3Hz', '4Hz', '5Hz', '6Hz', '7Hz'])
  df['1Hz']=pd.Series(get_values_for_frequency(1))
  df['2Hz']=pd.Series(get_values_for_frequency(2))
  df['3Hz']=pd.Series(get_values_for_frequency(3))
  df['4Hz']=pd.Series(get_values_for_frequency(4))
  df['5Hz']=pd.Series(get_values_for_frequency(5))
  df['6Hz']=pd.Series(get_values_for_frequency(6))
  df['7Hz']=pd.Series(get_values_for_frequency(7))
  df = df.round(decimals = 3)                  #Round a table values in DataFrame to3 decimal places
  print(&quot;created table datatype\n&quot;,df.dtypes)  #viewing the datatype of table
  df.to_csv(&quot;float_csvfile.csv&quot;,index=False)   #the raw values are written into the csv file.
  </code></pre>
  <p>I tired to give two inputs to the function as def</p>
  <pre><code>get_values_for_frequency(freq,samplepoints):
  </code></pre>
  <p>and called the function with</p>
  <pre><code>df = pd.DataFrame(columns =['1Hz','2Hz', '3Hz', '4Hz', '5Hz', '6Hz', '7Hz'])
  df['1Hz']=pd.Series(get_values_for_frequency(1,100))
  df['2Hz']=pd.Series(get_values_for_frequency(2,200))
  df['3Hz']=pd.Series(get_values_for_frequency(3,300))
  df['4Hz']=pd.Series(get_values_for_frequency(4,400))
  df['5Hz']=pd.Series(get_values_for_frequency(5,500))
  df['6Hz']=pd.Series(get_values_for_frequency(6,600))
  df['7Hz']=pd.Series(get_values_for_frequency(7,700))
  </code></pre>
  <p>yet I receive the same column length for each column.
  Can anyone help me to solve for different column lengths. Thanks</p>