Jump to content
Search In
  • More options...
Find results that contain...
Find results in...


  • Content Count

  • Joined

  • Last visited


This user doesn't have any awards

About DominHoes

  • Title

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Found the solution. By importing matplotlib.dates, i was able to access 'mdates.Dateformatter' and use it in plt current axes or plt.gca().
  2. tried it, still gives me Traceback (most recent call last): File "highs_lows.py", line 43, in <module> plt.xlim([datetime.date(2014,1,1), datetime.date(2014,12,22)]) TypeError: descriptor 'date' for 'datetime.datetime' objects doesn't apply to a 'int' object
  3. I'm back with more python problems! I was trying to get date, high and low of a temperature from sitka weather in 2014.csv The dates start from 2014-1-1 and end in 2014-12-22 That code shows me the graph i attached below. Problem is the ticks or step size of the date is by 2, i was trying to change it to day-month-year with autofmt_xdate but all i got was Year and month. I suppose the code misinterpret the month and or the day in 2014-1-1 in weather_history-2014.csv. I have tried xlim but cant really do it with datetime.date(2014,-1,-1) it shows me plt.xlim([datetime.date(2014-1-1), datetime.date(2014-12-22)]) TypeError: descriptor 'date' for 'datetime.datetime' objects doesn't apply to a 'int' object long story short, how to change 2014-01 to 01-January-2014? Edit: Solved by using the matplotlib.dates to format the x-labels here is the code myFmt = mdates.DateFormatter('%Y-%b-%d') plt.gca().xaxis.set_major_formatter(myFmt) The ticks or step size of the X might still be by 2, but for now im satisfied. Edit: add this to set x labels by month. MonthLocator for every month, YearLocator for every year plt.gca().xaxis.set_major_locator(mdates.MonthLocator())
  4. ah yes, the questions may change, the function stays. Gotcha
  5. I'm trying to take an anonymous survey of peeps first language. here is the survey and here is the language_survey my problem is here in the language_survey: the error said question isnt defined. Traceback (most recent call last): File "language_survey.py", line 9, in <module> my_survey.show_question() File "G:\Python\python_work\files_and_exceptions\survey.py", line 13, in show_question print(question) NameError: name 'question' is not defined Any help would be appreciated, thanks in advance