Uncategorized

Analysis: Weather in Amsterdam (November 9 – 16, 2019)

In a previous post I embedded a Jupyter Notebook that used DarkSky’s API to pull weather data about a random location in Amsterdam. In this post I display some of the graphs plotted from the data.

The data consists of 168 data points, these are hourly predictions of the weather in Amsterdam. The data ranges from November 9th 19:00 to November 16th 19:00.

Unfortunately, I was not able to properly save the plots as images. Therefore, to read the x axis you might have to resort to some eye squinting and zooming in (ctrl + scroll up).

Data cleaning

After I loaded the API data into a dataframe, I looked through DarkSky’s documentation to understand the data. The API call that I used mostly fetched data in units from the imperial system. As I am more familiar with the metric system, I used formulas to change to convert it to other units. Second, I changed the Unix time column in the dataframe to ‘datetime’. I also added a shortened version of the time for it to be more legible on the x axis of the plots.

You should also be able to fetch data in units from the metric system through the API. However, I wanted to play around with the units myself.

# Fahrenheit to celsius
df['temperature'] = (df['temperature'] - 32) * (5/9)
df['apparentTemperature'] = (df['apparentTemperature'] - 32) * (5/9)
df['dewPoint'] = (df['dewPoint']- 32) * (5/9)
# Miles to kilometers
df['visibility'] = df['visibility'] * 1.609344
# Unix to datetime
df['time'] = pd.to_datetime(df['time'],unit='s')
# Changing the datetime format
# I want to see: day, shortened month name & hour and minutes
df['time_short'] = df['time'].dt.strftime('%d %b %H:%M')

Graphs

In order to plot these graphs, I used matplotlib. To save the images, I used:

plt.savefig('temp.png')

Temperatures in Amsterdam

This line graph displays two different lines. The blue line predicts the actual temperatures per hour. The orange line shows what the actual temperature will feel like.

Precipitation in Amsterdam

This line graph shows the precipitation in milliliters per hour.

Wind speeds in Amsterdam

This line graph shows the wind speeds in Amsterdam in kilometers per hour.

Dew points in Amsterdam

This line graph shows the different dew points over the course of time in Amsterdam, the data points are in degree Celsius.

Want to use this weather API?

Go to DarkSky‘s website, make an account and get your own free key!

Uncategorized

Jupyter Notebook: Weather in Amsterdam

I found an interesting and free API: darksky. Darksky allows you to pull weather related data, from any location you desire. All you have to do is sign up and you’ll receive a key that will give you access to their API.

I pulled hourly data from their API for a random location in Amsterdam. Below I have embedded a Jupyter Notebook in which I have plotted different weather related factors such as: temperature, wind speed, visibility, and precipitation.

Uncategorized

How to embed your Jupyter Notebook into a WordPress post. No plugin needed. [beginner’s guide]

You’ll need:
– Jupyter Notebooks in ‘tree mode’
– Jupyter Notebook terminal or Linux terminal
– A Github account
– A WordPress account
– The ‘Gist’ extension

This guide will first help you to create a ‘gist’ of your notebook, which will then be embedded into your wordpress post.

Installing the gist extension on my Windows machine

To get the gist extension up and running on my Windows machine I ran the following code in the Anaconda terminal:

pip install jupyter_contrib_nbextensions

pip install jupyter_nbextensions_configurator

Installing the gist extension on my Linux machine

The windows installation method did not work for my Linux machine. To achieve the same thing, I used the following code in my Linux terminal:

conda install -c conda-forge jupyter_contrib_nbextensions

Enabling the Gist extension

Next, make sure that you’re viewing the Jupyter Notebook you want to embed in your WordPress in ‘tree mode’.

Second, we are going to enable the ‘Gist’ extension. To do this, go to the Edit > nbextensions config. This will open a new window with a list of extensions. Look for ‘Gist-it‘. When you click on ‘Gist-it’. You’ll be able to set the parameters for the extension.

The first parameter we need to set is the ‘Github personal access token‘. To get this token, you’ll need to go to your personal Github account. This token can be generated at: https://github.com/settings/tokens. Click on ‘generate new token‘. Then fill in a name for the token in the ‘Note‘ textbox. After that, select ‘gist‘. Right after creating the token, you’ll see your own personal access token. Copy it. DO NOT share this token with other people.

Set the parameters for the gist extension in your nbextension config window.

Get your personal access token on your Github account. Click “generate new token”.

After copying the personal access token from your Github account, go back to the nbextension config window and paste the token into the first parameter field ‘Gitbub personal access token‘. Next, check the ‘Gists default to public‘ box.

Sharing the notebook to gist

Gist.

Go to the notebook you would like to add to your Github gist (in tree mode). And click on the Github logo that is now present in the Jupyter Notebook task bar.

When you click on the logo a new window will appear that asks for a gist id. If this is the first notebook your adding to your gist, you won’t need to fill in an id. So skip this field. Check the ‘make the gist public box‘. And add a description, this will be the title of your gist.

Go to your gists on Github. You can easily access these by clicking on your profile picture in the righthand corner. A dropdown menu will appear. Click on ‘your gists‘. If it went well, you’ll see your Jupyter notebook on this page.

Embedding your gist on WordPress

Open the gist by clicking on it. Then copy the URL from your browser. This is the URL to your gist. Make a new WordPress post. Make sure your WordPress ‘block’ is switched to HTML. Paste the URL into the HTML block. And you’re done. Publish your post and look at your site. Your first Jupyter notebook on WordPress.

Big Data

Big Data: volume, velocity, variety… and value

Doug Laney introduced us to the first 3 Vs of big data back in 2001. The three original Vs were volume, velocity, and variety. As we have amassed more data over time, the volume of data has increased. Think about sensor-meters on machines. We can now investigate how machines in a factory or a warehouse are doing based on continuous sensor readings. Furthermore, through our smart devices and social media platforms, even more data is being generated. The emergence of the internet of things (IoTs) has brought us a goldmine of datasets.

What makes big data even more special is that this data arrives repeatedly in realtime. We can monitor machines as they drill oil, likes on social media posts are instantly registered, and rainfall measures are continually measured and recorded. These three examples fall under the second V, velocity. The speed at which data arrives has increased incredibly over the last decades. This has been facilitated by the increase in bandwidth and internet speeds.

Moreover, we have a myriad of different types of data formats now. Think about the different types of data an online store can generate. First, there are the click paths that people go through on the website. The information the customer fills in on the website. What items a customer ends up buying. What payment method they used. And those are just a few examples. All of these actions generate different data formats that need to be stored, processed, and analyzed.

Other scholars and big data engineers have added other Vs to the mix. Examples are variability, veracity, and visualization. But in this post I would like to discuss a different V, referred to as value. Big data on the surface of things seems great. We have a lot of information. Which pleases those who adhere to the ‘law of large numbers’. In statistics there are many principles that point toward the idea of bigger is better. Think of the central limit theorem, the larger the sample size, the more likely the sample will morph into a normal distribution. And increasing the sample size is all about getting an answer that is closer to ‘reality’. We want a sample represents the population.

But let’s say we’re a company. We have loads of data. Statisticians would be jealous of our datasets. So much data. But what now? We let the data sit in a database or a distributed file system for a couple of weeks before we analyze it. We analyze it, and oops – it’s already too late. The interesting trends we found through our analysis are now irrelevant. That is why we should seek value in our data. It means acting fast, it means performing the right analyses. It also means realizing what we want to achieve with our data. Do we want to increase sales? Do we want to understand our population better? Do we want to facilitate better decision-making processes?

We have to know what we’re doing, that is why the value principle is so important. This principle is based on our other Vs as well, the volume, variety, and velocity of the data. Value is often overlooked but it is definitely imperative to your big data solution.

social media

social media marketer: “you need a level of superficiality for social media”

This post is part of a series that looks at social media from different perspectives. My second interview was with a social media marketer.

We first start to talk about social media itself. I am curious to hear about her personal opinion on online platforms. She explains to me that she has a love-hate relationship with them. She is concerned about the privacy breaches and bad algorithms, content that she liked once, will repeatedly show up. However, she likes the fact that it is easy to get updates on the people she knows.

If you post it, it has to be perfect

People refuse to participate
My interviewee has worked with companies to improve their social media. For this she required participation from the company. Though this was hard to achieve. People are excited about social media but refuse to participate. They’ll tell her “if you post [something], it has to be perfect” or “people do not want to see my content”. Thus, the people within companies do not believe their content is exciting enough to be shared or that they will not be able to live up to a certain level of perceived perfection that they feel is required. Furthermore, they experience difficulties posting content due to the strict rules the management has laid on them. And on top of that, people experience self-censorship when engaging with social media. Which is fueled by social pressures from other coworkers or their own strive for perfection. A sentiment the social marketer also shares with the people within a company is that there is an anxiety that comes from ‘playing’ around with company’s brands. You don’t want ruin a company’s image.

#hashtag#hashtag#hashtag#hashtag#hashtag

To post is to exist
But the social media marketer doesn’t just look at social media from her work perspective, but also as a consumer. If she’s looking for a specific company, and they haven’t posted for a month, she’ll start to question if they’re still around. Another social media pet peeve of hers is social media managers who do not know how to use social media. As an example she mentions people who do not put spaces between their hashtags. On some platforms this will result in one long hashtag that won’t function properly. On the other hand, she also wonders about self-proclaimed social media experts who claim to be able to help you expand your clientele. If these experts spend a lot of time on social media explaining their expertise… how will they have time left to actually help their clients? This way they are signaling that they might now have work. She compares it to ‘clean desk policies’. If people have a clean desk at work, are they spending time working or cleaning their desks? A clean desk then signals that they might not be working after all. A messy desk suggests the opposite.

Don’t think about all the things that can go wrong

You need a level of superficiality
Over the years she has learned that with social media you can’t go too ‘deep’, you need a level of superficiality to practice social media marketing. And you definitely shouldn’t “think about all the things that can go wrong”. A problem she faced while working on social media related content is that she would overthink it. You just need to think about your target audience and consider your statistics. People should look at the ratio between website visits and the call to action. If people merely visit your website, but don’t buy your products, then something is clearly wrong. If you are not getting that many visits, but most visitors buy your products, you’re on the right path. She explains to me that people have been making this mistake for decades. The same principle holds for flyers people would receive in the mail. If not done correctly, they would also not lead to more sales. She feels that there is a discrepancy between sales and marketing, which she calls ‘waste’. Both departments will end up blaming each other for the lack of sales. There is no group looking at why this waste is happening.

Who am I communicating with?

Doing business is still personal
She recommends businesses to retain a personal touch in their online communication and on their platforms in general. This could be in the form of pictures of employees or by being able to see names of the people you communicated with. When she interacts with businesses online she asks herself “who am I communicating with?”. Knowing who the person is and if they have talked before would beg understanding. For instance, in customer service, does the person know her case or does she have to explain it again? “Doing business is still personal”. We end the interview on the note that companies cannot survive without an online presence, as it happens facilitate the ability to easily find information about the company. She adds: “when I hear about a company [offline], I will look them up online first”.

social media

Linguistics student: “discourse is directer and harsher on social media”

This post is part of a series that looks at social media from different perspectives. My first interview was with a student in linguistics and American studies.

Language
My interviewee explains to me that the language on each social media platform is different. He names a couple of platforms such as Twitter and 4Chan that have distinct ways of interaction and incorporate memes into their communication. However, groups on these platforms also have different ways that they utilize language, ‘Black Twitter’ is an example of this. Online users learn ways of setting up jokes that is only recognizable to them and their online peers, which is facilitated through the language they use. Furthermore, younger generations will develop parts of their identity through online interactions. He names interests and political affiliations as examples.

Some people think that language deteriorates because of social media. But my interviewee disagrees. He argues that language becomes more standardized and globalized as a result of its role on social media. Consequently, people will be able to communicate with one another with much more ease. However, I then wondered if it would be harder to discuss more complex topics online using this standardized form of language. He disagreed. He lists simple topics that will be easier to discuss with this type of language and further explains to me that abstract topics such as politics and philosophy will still be discussed, but just using different language.

Discourse: 4Chan vs Twitter
He believes that discourse could depend on the topic that is discussed on social media and explains to me that there isn’t necessarily one type of discourse that is inherent to social media. However, he does see a distinction between the discourse in older forms of media and social media. The anonymity influences the discourse on social media platforms, it is much directer and harsher now. Yet, the degree of anonymity varies between platforms, which causes some discourse to be even harsher in some online settings. He uses 4Chan and Twitter as examples again, explaining that users on Twitter have more identifiable characteristics than 4Chan users. Therefore, the harshness on 4Chan is expected to be more severe.

The World and Social Media
The bigger platforms that are used in the ‘west’ tend to originate from the United States. However, while these websites are American, countries filter the content on the platforms. He comes up with a personal example. In order to see more American content on YouTube, he had to change his settings. However, it appears that the U.S. is a forerunner when it comes to online trends and challenges. But ‘nonwestern’ countries are also starting to become influential online. Tiktok and anime are two prime examples of this.

Social Media is a double-edged sword

Advantages vs. Disadvantages
He definitely thinks there are advantages to social media. First, he believes that he has learned a lot about different cultures and people through the use of social media. Though, there is still a possibility that you end up in a filter bubble, which is a disadvantage. Furthermore, teenagers might spend less time outside and adults might spend less time talking face-to-face. Yet, he does believe that it could be easier to find like-minded individuals to form a connection with. It all depends on how you look at it.

Social media has the potential to have a positive effect. But in its current form it does not. Especially since bigger corporations own the platforms, which they run for profit. Their objective is not to create a human experience online. Each recommendations seems to serve to pull you to click or buy with the goal to profit. Furthermore, there are inequalities online, since the majority have a strong presence, they influence the recommendations you see online. Minorities are underrepresented in online settings. Social media is socially segregated.

social media

what do we think about social media?

Social media has both been criticized and hailed by different groups and individuals. People have varying perspectives on the advantages and risks of using social media. To understand these contrasting views, I will be interviewing several people with different backgrounds to get an overview of the diverse views regarding social media. The perspectives that will be discussed include: linguistic, cybersecurity, social media marketing, and self-advertisement. These interviews will take place over the next two months and will be posted on this blog.

social sciences

who rules the world?

Decades ago Judith Butler wrote about a concept called ‘gender performance’. This means that gender does not pre-exist the person, gender is a result of a set of behaviors. Nowadays the construction of gender has become a controversial topic. Especially in the light of awareness of transgenderism, there are debates about the differences between assigned sex and gender. Some believe these are the same, others believe that these are two separate concepts. Then the question arises whether gender is the result of socialization or genetics – or both. Though, one thing is clear, your gender influences your experience.

Throughout history men have generally been part of the dominant group in society. And on top of that, if we look at specific histories such as the U.S., we see that it also helps to be of a certain skin color and to be part of a higher social class. For instance, before the nineteenth century, voting was restricted to white men of age whom owned property. Therefore, gender alone does not predispose a person’s advantage, there are other intersectional factors. However, for now I will simplify matters by solely looking at gender.

who rules?
Connell has developed a theory over the years, which is now referred to as ‘hegemonic masculinity’. Merriam-Webster defines a hegemony as “the social, cultural, ideological, or economic influence exerted by a dominant group“. According to Connell’s theory, a specific kind of masculinity is considered to be ideal. This type of masculinity dismisses any alternative forms of masculinity or femininity. Sexual prowess, physical strength, and stoicism are all considered to be ideal performances of masculinity. If one were to divert from these ideals, then a person would be performing an alternative masculinity.

Furthermore, there is pressure from others in the dominant group of hegemonic masculinity to strive to fit the ideals. This leads to the exclusion of gay peers or the sexual objectification of women. Because the standard is considered to be heteronormativity, this norm predicates that romantic and/or sexual relationships take place between a man and a woman. Moreover, let’s go back to intersectionality for a second. Hegemonic masculinity does not only exclude ‘deviating’ sexual orientations, but also other identity characteristics. Researchers posit that hegemonic masculinity is restricted to “white, heterosexual, upper and middle-class men”.

times are a-changing?
Other researchers now suggest that masculinity is changing. The pressures of performing behavioral ideals related to hegemonic masculinity is decreasing. Masculinity performances are becoming more inclusive, therefore researchers are proposing new theories, such as inclusive masculinity theory or other hybrid masculinity theories. These types of masculinities have no problems having gay peers in their group of friends and tend to be more emotionally open. Furthermore, tactility is accepted among these men, which means that affectionate acts such as hugging are encouraged.

According to the same researchers, this inclusive masculinity performance is likely possible due to a decrease in homohysteria. Homohysteria is the apprehension of being perceived as gay. A lack of such a hysteria paves the way for masculinities that are not in line with hegemonic masculinity ideals. Therefore, feminine behaviors by men will be less likely to be denounced. Because hegemonic masculinity creates clear lines between masculinity and femininity, ‘feminine’ behaviors such as emotional expression is discouraged. However, as alternative masculinities are more and more recognized, these binary gender lines start to blur. In this contemporary scenario, the objective of masculinity is no longer to dominate other genders. If this trend continues, it begs the question of how society will be shaped as a result. Will power relations based on gender be any different?

Opinion

[transcript] philosophy behind the U.S. constitution

Today we will discuss the philosophy behind the American constitution. The American constitution didn’t come out of nowhere, it is based on the ideas the framers had about humans and human nature. Imagine you are one of the framers. It’s 1787. You’re about 25 years old and you have to write the most important legal document in American history. What would you write? How would the government be structured according to you? Would it have separate branches? Would this system include checks and balances? Are you designing a federalist system? What rights do people have in this scenario? These are all questions the framers tried to answer. A lot of concepts in the constitution seem incredibly self-evident today.

But where did the framers get their ideas from?

The most important philosopher from which the framers borrowed ideas was Locke. Locke lived from 1632 to 1704. The constitution was written and signed in 1787, long after Locke died. Thus, he never saw the constitution come to life. However, he is said to have helped write the Fundamental Constitutions of Carolina in 1669.

Locke is and was a very influential philosopher that came up with wide range of ideas. He is one of the most important Enlightenment thinkers that inspired the ideology of liberalism. His ideas about natural rights, the social contract, and democracy were imperative to the creation of the American constitution. The Second Treatise of Locke’s work, which is called Two Treatises of Government was especially important to the framers. Let’s go over some of the concepts from this interesting philosophical work! I will be quoting bits and pieces from Locke’s second treatise and tie it to the American constitution.

Locke writes the following.

“Men all being naturally free, equal, and independent, no-one can be deprived of this freedom etc. and subjected to the political power of someone else, without his own consent.”

Locke starts with a premise that people are born free and that they have natural rights as a result. People possess agency over themselves. An idea that is so self-evident to us now that we almost take it for granted. Quote. “every man has a Property in his own Person”. Unquote. This means that every individual has ownership over his or her own body. The first ten amendments of the American constitution — also called the Bill of Rights  — protect people’s individual liberties and they limit the powers of the government.

However, some natural liberties disappear once people live in a civil society.

“The only way anyone can strip off his natural liberty and clothe himself in the bonds of civil society is for him to agree with other men to unite into a community, so as to live together comfortably, safely, and peaceably, in a secure enjoyment of their properties and a greater security against outsiders.”

Thus in order to make civil society possible and to protect your property, people will not be able to exercise all of their natural liberties. But this way of living ensures comfort, safety and peace for all civilians.

On property, one of the framers, Madison, said the following.

“It is sufficiently obvious, that Persons and Property, are the two great subjects on which Governments are to act: and that the rights of persons, and the rights of property are the objects for the protection of which Government was instituted. These rights cannot well be separated. The personal right to acquire property, which is a natural right, gives to property when acquired a right to protection as a social right.”

Here we can see how Madison emphasizes that property AND individual rights ought to be protected by the government, an idea that Locke wrote about a century earlier.

Locke further writes that people have to consent to be a part of this community in civil society.

“When any number of men have in this way consented to make one community or government, this immediately incorporates them, turns them into a single body politic in which the majority have a right to act on behalf of the rest and to bind them by its decisions.”

Locke upholds the idea of a democracy where the majority gets a say. Furthermore, the consent that people give implies that the government exists to serve society. This idea can be found in the very first words of the preamble of the American constitution. It starts with the famous phrase “we the people”. The constitution and the government exist for the people.

In summary what we have just learned is that government is formed through the consent of the people. The people form a political body which will uphold values such as safety and peaceful living. Men are born free and equal with natural rights. However, this does not mean that people are entirely free to do what they want to do. They have to adhere to the common laws and in return they will receive protection from the government.

There is one last quote I would like to read out to you from Locke’s Second Treatise.

“But this is only an ‘entrusted’ power to act for certain ends, so that the people retain a supreme power to remove or alter the legislature when they find it acting contrary to the trust that had been placed in it.”

Thus, the government is responsible to society. And when the government no longer serves the people, then the people get to change the government. The framers protected people from a tyrannical government by incorporating checks and balances such as holding consistent elections and through the mechanisms of federalism.

My aim of this podcast was to show you that the constitution did not come out of thin air. It is based on the philosophical works that the framers deemed as important for governing a Republic. Philosophical ideas influence how we perceive things around us and what we think the world should be like. Locke’s ideas are normal to us now – but they were definitely revolutionary during Locke’s lifetime. I hope you learned something new today. If you would like to read the transcript, please go to my website at socialscienceblog.org. Thank you for listening.