(Fix) ValueError: Argument Z must be 2-dimensional

Problem Formulation The output when running this code is as follows Warning (from warnings module): File “C:\Users\xcent\Desktop\code.py”, line 10 ax = fig.gca(projection=’3d’) MatplotlibDeprecationWarning: Calling gca() with keyword arguments was deprecated in Matplotlib 3.4. Starting two minor releases later, gca() will take no keyword arguments. The gca() function should only be used to get the current … Read more

How Do I Make a 3D Waterfall Plot with Colored Heights in Python?

To generate a 3D waterfall plot with colored heights create a 2D sine wave using the NumPy meshgrid() function, then apply a colormap to the heights using Matplotlib’s Normalize function. The plot_surface() function generates the 3D plot, while the color gradient is added using a ScalarMappable object. Here’s a code example for copy and paste: … Read more

3 Easy Ways to Check Your Internet Speed in Python

Method 1: Speedtest-cli To measure your Internet speed with Python, you can use the Speedtest-cli method. This Python library provides a command-line interface for testing internet bandwidth using speedtest.net. It performs a comprehensive test, providing download speed, upload speed, and latency data. First, install the speedtest-cli library using: pip install speedtest-cli The following example can … Read more

Python Sleep For Less Than a Second

πŸ’‘ Problem Formulation: Chances are you’ve already figured out that you can get your Python program to sleep for one second using time.sleep(1). But how do you sleep for less than a second, e.g., for half a second (0.5s), milliseconds, or even microseconds? Method 1: Use time.sleep() The time.sleep(seconds) function halts the Python program for … Read more

No, GPT-4 Doesn’t Get Worse Over Time (FUD Debunked)

There has been a lot of drama on Twitter about the new Stanford UC Berkely collab paper titled “How Is ChatGPT’s Behavior Changing over Time?” (source) The paper’s authors selectively provide examples where newer versions of GPT-4 seem to perform “worse” and have “formatting mistakes” than older versions. The first evaluation they provide is the … Read more

Python OpenAI Streaming Completions

Set stream=True when calling the chat completions or completions endpoints to stream completions. This returns an object that streams back the response as data-only server-sent events. Streaming completion is an essential functionality offered by OpenAI, particularly useful in the implementation of real-time applications like live text generation or interactive conversational bots. Traditionally, this feature has … Read more

Llama 2: How Meta’s Free Open-Source LLM Beats GPT-4!

Meta (formerly Facebook) has released Llama 2, a new large language model (LLM) that is trained on 40% more training data and has twice the context length, compared to its predecessor Llama. Llama 2 is open-source so researchers and hobbyist can build their own applications on top of it. Llama 2 is trained on a … Read more

Pandas DataFrame Object: A Beginner’s Guide

When working with data in Python, one of the most powerful tools at your disposal is the pandas DataFrame. πŸ’‘ A DataFrame is a two-dimensional data structure, which essentially looks like a table with rows and columns. This versatile data structure is widely used in data science, machine learning, and scientific computing, among other data-intensive … Read more

What Is Finxter? Google Bard vs ChatGPT Response

What Is Finxter? Google Bard’s Reply πŸ‘‡ Here’s the reply from Google Bard: πŸ‘‡ Finxter is an online platform that provides educational resources for computer science and coding. Their primary goal is to boost the collective intelligence in the area of computer science. Among their users are beginner coders, ambitious computer science students, and professional … Read more

The AI Fact Generator: A Tapping Party for Your Brain

This AI Fact Generator will randomly generate a fact about artificial intelligence, machine learning, or data science. Click the button to see a new fact! πŸ‘‡ Change Fact πŸ’‘ Fact: Want to learn more about AI, ML, and DS? Join our free email academy with 150,000+ readers and download my simple coding cheat sheet. You’ll … Read more