How to make a daily trending line chart from multiple daily csv files

165 views Asked by At

I am working on developing a program in python that can display trending data from multiple csv files that are created each day. In each of those files are two columns of information (example):

Name      |     Downloads
Facebook          42
Myspace            3
Foursquare        12

The information is tracking a set of about 15 or so programs and how many times it was downloaded that particular day. I need to write a program that can take all those csv files and create a chart that shows growth or decline. The chart would have multiple colored lines with a legend displaying what each color represents. The chart would be segment by day and the lines would go across rising and falling depending on what the daily total was from the csv file. I'm just not sure where to start with the program.

Edit to include some work done. I'm using Jupyter to run and display the results. I would like to eventually incorporate Bokeh to easily change fields.

import -----

glob.glob(directory + '/' + "daily*.csv)
all_data = pd.DataFrame()
for f in glob.glob(directory + '/" + "daily*.csv):
    df = pd.read_csv(f)
    all_data = all_data.append(df,ignore_index=True)

status = pd.read_csv(f)
status

csv is displayed

records = pd.read_csv(f)

A dictionary is created here to group all the daily apps into all_files = []. After that I create a bar chart that displays in order all the files from most downloaded to least.

plt.gcf().subplots_adjust(bottom=0.05)
width = 30
scale = 55
fig, ax = plt.subplots()
plt.bar(range(0, scale*len(top_files[0]), scale), top_files[1], width)
ax.set_xticks([scale*i+width/2 for i in range(scale*len(top_files[0]))])
ax.set_xticklables([app for app in top_files[0]], rotation='vertical')
ax.xaxis.grid(False)
plt.ylabel("Total")
plt.ylim((0,250))
plt.xlim((0, scale*len(top_files[0])))
ax.set_aspect(6)
plt.tight_layout()
plt.show()

The only difficult part of all of this is the computer that all the code resides on is not, and will not be connected to the internet. So most work has to be repeated and copied, which is why I skipped some boring parts like dictionaries and imports.

This is also just one example of what I am working with. I've has written up a heat map to display a larger amount of data, but in the end I'm stumped on how to get multiple lines to display across a chart.

0

There are 0 answers