title: if else statement python using plot parameters in function
body: <p>I have an if else statement in my function that is not wokring the way i want it to. Mind you I am still learning python and all things programming.</p>
  <p>I have a function to define a plot. Idea is to create a large python repo for data analysis. EDIT: i added a working make shift dataframe for you to try</p>
  <pre><code>import matplotlib
  import matplotlib.pyplot as plt
  import pandas as pd
  #import numpy as np
  #import os
  #import dir_config as dcfg
  #import data_config as datacfg
  import matplotlib.dates as md
  #import cartopy.crs as ccrs
  
  data = {'dates': [20200901,20200902,20200903,20200904,20200905,20200906,20200907,20200908,20200909,20200910],
          'depth': [1,2,3,4,5,6,7,8,9,10],
          'cond': [30.1,30.2,30.3,30.6,31,31.1,31.0,31.4,31.1,30.9]
          }
  df = pd.DataFrame(data, columns = ['dates', 'depth', 'cond'])
  df['pd_datetime'] = pd.to_datetime(df['dates'])
   
  
  def ctd_plots_timeseries(time=[],cond=[], sal =[], temp=[], depth=[], density=[]):
      #-----------
      # CONDUCTIVITY PLOT
      #-----------
      
      if cond == []:
          print(&quot;there is no data for cond&quot;)
          pass
      else:
          plt.scatter(time,depth,s=15,c=cond,marker='o', edgecolor='none')
          plt.show()
  
      #-----------
      # SALINITY (PSU) PLOT: I do not want this to plot at all due to its parameter being 'empty' in the function when called
      #-----------
      if sal == []:
          print('there is no salinity data')
          pass
      else:
          plt.scatter(time,depth,s=15,c=sal,marker='o', edgecolor='none')
          plt.show()
  
  
  ctd_plots_timeseries(depth = df['depth'], time = df['pd_datetime'], cond = df['cond'])
  </code></pre>
  <p>The idea here is that if there is no data in the cond value, do <code>pass</code> to not show the plot.
  However ever time I run this, the plot shows, even thought there is no data for it.</p>
  <p>When i call the function i put in <code>plot_timeseries(time=time_data, depth=depth_data temp=temp_data)</code></p>
  <p>my aim is for only the temp data in this example to show, not a cond graph with no variables.</p>
  <p>what i have tried is</p>
  <pre><code>if cond != []:
          plotting code
          plt.show()
  else:
          print('there is no cond data')
          pass
  </code></pre>
  <p>and</p>
  <pre><code>plotting code
  if cond == []:
      print('no cond data')
      pass
  else:
      plt.show()
  </code></pre>
  <p>to no avail.</p>
  <p>note that there are 4 other plots in this function i would like to do the same thing. thanks for any insight this community can give me.</p>
  <p>UPDATE:
  I changed the conditions in the function to <code>def ctd_plots_timeseries(time=0,cond=0, sal =0, temp=0, depth=0, density=0):</code>
  and then changed conditional statement to</p>
  <pre><code>if cond != 0:
      graphing code
  else:
      print('no data here')
  </code></pre>
  <p>i get the following error:
  <code>ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().</code></p>