Conversation
find_max.py
Outdated
| @@ -0,0 +1,8 @@ | |||
| # Function to find maximum value from the list | |||
| class Max: | |||
There was a problem hiding this comment.
There's a built-in max() method in python.
main.py
Outdated
| from read_csv_all import Find | ||
|
|
||
|
|
||
| class Main: |
There was a problem hiding this comment.
Rename this class to something else. something like Weather because main is used for different purpose.
read_csv.py
Outdated
| @@ -0,0 +1,39 @@ | |||
| from find_max import Max | |||
| class ReadFiles: | |||
There was a problem hiding this comment.
- Pep-8 missing. There must be 2 blank lines before a class.
- Why do you have to make a separate class for all these helper methods. Move all these methods inside the
Weatherclass inmain.py
There was a problem hiding this comment.
yes sir you are right this is better approach.
read_csv_all.py
Outdated
| import os | ||
| from find_max import Max | ||
| from read_csv import ReadFiles | ||
| class Find: |
There was a problem hiding this comment.
- Pep8 missing
- move these methods to the
Weatherclass.
read_csv_all.py
Outdated
| if hottest_temp == Max.find(ReadFiles.read_files(file, filename)): | ||
| li.append(filename) | ||
|
|
||
| return print(f"The overall Hottest Temperature is:- {hottest_temp} at months:- {li}") |
There was a problem hiding this comment.
return must return some values not the print statement.
There was a problem hiding this comment.
yes sir I just fixed it
sadan
left a comment
There was a problem hiding this comment.
Look at the rest of the codes again and use more meaningful variable names.
main.py
Outdated
| data_list.append(int(data[1])) | ||
|
|
||
| # Find the maximum temp from Max TempC | ||
| found = self.search_max(data_list) |
There was a problem hiding this comment.
use python max() method to find the maximum value in a list.
There was a problem hiding this comment.
when using max() method it causes an an error "ValueError: max() arg is an empty sequence"
as in my csv data there are many months those are empty in temperature column.
main.py
Outdated
| high_temp.append(Max.find(ReadFiles.read_csv_files(file, filename))) | ||
| hottest_temp = Max.find(high_temp) | ||
| # Find the maximum temp from Max TempC | ||
| found = self.search_max(data_list) |
There was a problem hiding this comment.
rename this variable to be more meaningful with the data. Since you are storing maximum temperature, I would name it something like max_temp
… changes in some extra call of search_max method
Opening Pull request for weather data analysis.