scale

Scale pdf to DINA4 and then add a 3mm black margin around it (python)

Scale pdf to DINA4 and then add a 3mm black margin around it (python) Question: I have to check if a pdf file has the format of DIN-A4 and if it’s not it should be scaled to DIN-A4 (210mm x 297mm). After this on each side of the pdf should be added a 3mm black …

Total answers: 1

How do I create an extendable bar sprite in PyGame?

How do I create an extendable bar sprite in PyGame? Question: I want to use the following asset in my game: It has specific pixelated borders and corners. So I want it to scale "extending" the inner part of the asset by repeating it until it matches the desired size. So I can render something …

Total answers: 2

Scale data to -1 to 1

Scale data to -1 to 1 Question: I have rows of data containing numbers in the range of "-finite to finite". I want to transform this number to the range of "-1 to 1" as it shows polarity. I would like to enter the result into a new column inside the same dataframe. Here’s a …

Total answers: 2

Bitcoin Chart with log scale Python

Bitcoin Chart with log scale Python Question: I’m using Python (beginner) and I want to plot the Bitcoin price in log scale but without seeing the log price, I want to see the linear price. import pandas as pd import matplotlib.pyplot as plt import numpy as np from cryptocmd import CmcScraper from math import e …

Total answers: 1

How do I register the reciprocal (1/x) scale in Matplotlib?

How do I register the reciprocal (1/x) scale in Matplotlib? Question: Currently, I get this plot from my Python script: The frequency-period relation is not linear, it’s reciprocal, being period = 1./frequency or, if expressed as a power, period = frequency**(-1). The auxiliary x-axis scale is linear in my script, that’s why the red dashed-line, …

Total answers: 2

[sklearn][standardscaler] can I inverse the standardscaler for the model output?

[sklearn][standardscaler] can I inverse the standardscaler for the model output? Question: I have some data structured as below, trying to predict t from the features. train_df t: time to predict f1: feature1 f2: feature2 f3:…… Can t be scaled with StandardScaler, so I instead predict t’ and then inverse the StandardScaler to get back the …

Total answers: 3

Apply StandardScaler to parts of a data set

Apply StandardScaler to parts of a data set Question: I want to use sklearn‘s StandardScaler. Is it possible to apply it to some feature columns but not others? For instance, say my data is: data = pd.DataFrame({‘Name’ : [3, 4,6], ‘Age’ : [18, 92,98], ‘Weight’ : [68, 59,49]}) Age Name Weight 0 18 3 68 …

Total answers: 6

scikit-learn: how to scale back the 'y' predicted result

scikit-learn: how to scale back the 'y' predicted result Question: I’m trying to learn scikit-learn and Machine Learning by using the Boston Housing Data Set. # I splitted the initial dataset (‘housing_X’ and ‘housing_y’) from sklearn.cross_validation import train_test_split X_train, X_test, y_train, y_test = train_test_split(housing_X, housing_y, test_size=0.25, random_state=33) # I scaled those two datasets from sklearn.preprocessing …

Total answers: 2

What is the difference between 'log' and 'symlog'?

What is the difference between 'log' and 'symlog'? Question: In matplotlib, I can set the axis scaling using either pyplot.xscale() or Axes.set_xscale(). Both functions accept three different scales: ‘linear’ | ‘log’ | ‘symlog’. What is the difference between ‘log’ and ‘symlog’? In a simple test I did, they both looked exactly the same. I know …

Total answers: 3

Determine precision and scale of particular number in Python

Determine precision and scale of particular number in Python Question: I have a variable in Python containing a floating point number (e.g. num = 24654.123), and I’d like to determine the number’s precision and scale values (in the Oracle sense), so 123.45678 should give me (8,5), 12.76 should give me (4,2), etc. I was first …

Total answers: 11