QuestionId int64 74.8M 79.8M | UserId int64 56 29.4M | QuestionTitle stringlengths 15 150 | QuestionBody stringlengths 40 40.3k | Tags stringlengths 8 101 | CreationDate stringdate 2022-12-10 09:42:47 2025-11-01 19:08:18 | AnswerCount int64 0 44 | UserExpertiseLevel int64 301 888k | UserDisplayName stringlengths 3 30 ⌀ |
|---|---|---|---|---|---|---|---|---|
75,777,596 | 19,318,120 | building user-based collaborative filtering system in Django | <p>I'm trying to build a simple <code>user based collaborative filtering</code> in <code>Django</code> for an <code>E-commerce</code> using just the purchase history. <br />
Here are the steps I use, I know it needs more improvements but I've no idea what's the next move.</p>
<p>here's the product model</p>
<pre><code>... | <python><django><recommendation-engine><collaborative-filtering> | 2023-03-18 17:38:56 | 1 | 484 | mohamed naser |
75,777,573 | 15,520,615 | How to query for the maximum / highest value in an field with PySpark | <p>The following dataframe will produce values 0 to 3.</p>
<pre><code>df = DeltaTable.forPath(spark, '/mnt/lake/BASE/SQLClassification/cdcTest/dbo/cdcmergetest/1').history().select(col("version"))
</code></pre>
<p><a href="https://i.sstatic.net/n9Ylv.png" rel="nofollow noreferrer"><img src="https://i.sstatic.... | <python><apache-spark><pyspark><apache-spark-sql><databricks> | 2023-03-18 17:35:08 | 1 | 3,011 | Patterson |
75,777,298 | 914,641 | problem with the romberg method in scipy.integrate | <p>I'm running the following script with anaconda (scipy 1.10.0)</p>
<p>'''</p>
<pre><code>from math import cos, pi
from scipy.integrate import romberg
f = lambda x: x**2*cos(x)**2
res = romberg(f, -pi/2, pi/2)
print(res)
res = romberg(f, 0, pi/2)
print(res)
dx = 1e-4
res = romberg(f, -pi/2+dx, pi/2)
print(res)
... | <python><scipy> | 2023-03-18 16:47:37 | 1 | 832 | Klaus Rohe |
75,777,161 | 5,623,899 | Python3.10 decorator confusion: how to wrap a class to augment a class's __init__ e.g. to track function calls | <p>I'm getting myself confused with python decorators. Yes, there are a lot of useful resources out there (and I have consulted them prior to posting)</p>
<p>e.g.</p>
<ul>
<li><a href="https://stackoverflow.com/questions/627501/how-can-i-use-named-arguments-in-a-decorator">How can I use named arguments in a decorator?<... | <python><python-decorators> | 2023-03-18 16:26:42 | 1 | 5,218 | SumNeuron |
75,777,110 | 1,204,527 | Django and Huey task issue, record in DB doesn't exist when the task is ran | <p>I am testing Huey with Django and found one issue, tasks can't find the record in DB.</p>
<ul>
<li>Postgres 14</li>
<li>Redis 7.0.5</li>
<li>Django 4</li>
<li>use with docker</li>
</ul>
<p>Here is the code:</p>
<pre><code># settings.py
USE_HUEY = env.bool("USE_HUEY", False)
HUEY = {
"huey_class&qu... | <python><django><redis><python-huey> | 2023-03-18 16:17:15 | 2 | 4,381 | Mirza Delic |
75,777,109 | 1,615,703 | Unsupported result column Struct()[] for DuckDB 0.7.1 from_json | <p>I am trying to get a large set of nested JSON files to load into a table, each file is a single record and there are ~25k files. However when I try to declare the schema it errors out when trying to declare the data type if it is a struct. For reference, I was reading this article from DuckDB as well <a href="https:... | <python><json><python-3.x><duckdb> | 2023-03-18 16:17:12 | 0 | 313 | Mitchell Hamann |
75,776,827 | 13,122,378 | Best way to build application triggering reminder at certain time | <p>I want to build a python app sending reminder at certain time. It would have several subscribers. Each subscriber sets specific moment when they want to be notified. For example, John wants to have a reminder every days whereas Cassandra wants it every months.</p>
<p>I see several ways to do it :</p>
<ul>
<li>Use a ... | <python><web-applications><architecture> | 2023-03-18 15:28:41 | 1 | 654 | Pi-R |
75,776,824 | 15,776,933 | Running time in Python | <p>I wrote code to find the current time in Python. Its result is: 'Time: 20:49:08' my current time. Can I make the time show in seconds running, so the value of <code>%S</code> increases?</p>
<p>Code:</p>
<pre><code>import time
def current_time():
t = time.localtime()
current_time = time.strftime("%H:%M:%S&... | <python><time> | 2023-03-18 15:27:56 | 3 | 955 | Anubhav |
75,776,701 | 63,898 | Python flask debug or run keep getting : Unable to find python module message | <p>i have simple flask server running in vscode , i enable to debug and run but i keep getting the message :</p>
<pre><code>Unable to find python module.
</code></pre>
<p>on each step i do in the IDE</p>
<pre><code>foo.foo-PC MINGW64 /c/dev/my/microservices_tests/python/b37 -- -m flask run --no-debugger --no-reload ^C... | <python><visual-studio-code><flask><module> | 2023-03-18 15:07:41 | 0 | 31,153 | user63898 |
75,776,672 | 1,806,566 | Can pip be used with a custom metapath finder? | <p>In my environment, I need to manually install python packages in a non-standard location, and I need to archive the source tarballs of the packages I install. I'm using python 3.11. I install packages by downloading tarballs and running:</p>
<p><code>python3 -m pip install --prefix=xxx --no-deps --no-index --ignor... | <python><pip> | 2023-03-18 15:02:41 | 1 | 1,241 | user1806566 |
75,776,610 | 1,763,602 | Is there a difference between `import a as b` and `import a ; b = a`? | <p>It's common for me to write in REPL, for example:</p>
<pre><code>from datetime import datetime as dt
</code></pre>
<p>Is there a difference between this sentence and</p>
<pre><code>from datetime import datetime
dt = datetime
</code></pre>
<p>? For now I can list two:</p>
<ul>
<li>the first sentence is more readable<... | <python><syntax><include><python-import> | 2023-03-18 14:51:25 | 1 | 16,005 | Marco Sulla |
75,776,368 | 9,601,748 | How can I separate column by deliminator and make new columns from the split strings? | <p>Here's the dataset I'm currently trying to work with:</p>
<p><a href="https://i.sstatic.net/RY9Aq.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/RY9Aq.png" alt="enter image description here" /></a></p>
<p>What I'm trying to do is separate all the 'genres' values by the comma, and then create new colu... | <python><pandas><dataframe> | 2023-03-18 14:03:50 | 1 | 311 | Marcus |
75,776,286 | 1,176,573 | Join or Merge Pandas Dataframes filling null values | <p>I have two dataframes - <code>Deployment</code> and <code>HPA</code> as shown. Both dataframes mostly share the values in columns <code>Deployment-Label</code> and <code>HPA-Label</code> which need to merge/join by filling-up null values in all other columns in both dataframes (wherever the values are missing in eit... | <python><pandas><dataframe> | 2023-03-18 13:47:06 | 1 | 1,536 | RSW |
75,776,250 | 6,455,731 | How to import a module from a module within a package? | <p>I've heard that Python imports can be weird and I feel really stupid for not being able to fix this myself; so please somebody kindly explain how this import situation can possibly be a problem.</p>
<p>Directory structure:</p>
<pre><code>├── main.py
└── sub
├── sub1.py
└── sub2.py
</code></pre>
<p>Say sub1 d... | <python><import><module><package> | 2023-03-18 13:39:48 | 1 | 964 | lupl |
75,776,198 | 13,448,993 | How do I refresh a gradio button after pressing submit? | <p>I have a simple input/output gradio interface:</p>
<pre><code>import gradio as gr
def generate_output(input_text):
output_text = "Hello, " + input_text + "!"
return output_text
iface = gr.Interface(fn=generate_output,
inputs= gr.Textbox(label="Input Text"... | <python><user-interface><gradio> | 2023-03-18 13:31:39 | 1 | 523 | ardito.bryan |
75,776,058 | 8,511,822 | Python seedir treat zip/gzip files as directories? | <p>I am using the <a href="https://github.com/earnestt1234/seedir" rel="nofollow noreferrer">seedir library</a> to handle folder/file STDOUT and it works quite nicely. I wonder if there is an option to treat zip/gzip files as folder and list the individual files contained?</p>
<p>If this is not built in, would the pro... | <python> | 2023-03-18 13:01:19 | 1 | 1,642 | rchitect-of-info |
75,775,975 | 7,403,752 | Python requests stop redirects does not work | <p>I want to access the content of a web page, but I'm being redirected to another page even though I've set allow_redirects to False in my requests call. Here's an example code snippet:</p>
<pre><code>import requests
from bs4 import BeautifulSoup
headers = {'User-Agent': user_agent} # assume I inserted my user agent ... | <python><http-redirect><python-requests> | 2023-03-18 12:45:29 | 1 | 2,326 | edyvedy13 |
75,775,969 | 1,169,091 | What is the solid black rectangle adjacent to the decision tree? | <p>I adapted this code from <a href="https://www.dasca.org/world-of-big-data/article/know-how-to-create-and-visualize-a-decision-tree-with-python" rel="nofollow noreferrer">https://www.dasca.org/world-of-big-data/article/know-how-to-create-and-visualize-a-decision-tree-with-python</a>.</p>
<p>I removed two arguments to... | <python><graphviz><decision-tree><pydotplus> | 2023-03-18 12:44:40 | 1 | 4,741 | nicomp |
75,775,967 | 6,301,394 | Passing arguments to apply | <p>In Pandas, I currently use groupby apply this way (this is a MRE only):</p>
<pre><code>import pandas as pd
import numpy as np
class ApplyFunction:
def Close(df, *args):
return pd.DataFrame(df['Close'] * args[0])
class Placeholder:
def __init__(self):
self.ind = ApplyFunction.Close
s... | <python><python-polars> | 2023-03-18 12:44:26 | 1 | 2,613 | misantroop |
75,775,941 | 10,441,038 | Assign to a whole column of a Pandas DataFrame with MultiIndex? | <p>I have a DataFrame(called <code>midx_df</code>) with a MultiIndex, I want to assign values from a whole column of another DataFrame(called <code>sour_df</code>) with single level index to <code>midx_df</code>.</p>
<p>All of index values of <code>sour_df</code> exist in the top level index of <code>midx_df</code>, I ... | <python><pandas><dataframe><slice><multi-index> | 2023-03-18 12:38:28 | 1 | 2,165 | Leon |
75,775,937 | 3,442,409 | tensorflow.data.Dataset.from_generator() converts string arguments to bytes | <p>I have a custom generator which takes two dates in string format as arguments and yields (features, labels) from within the date range. I want to create a dataset out of it, but <code>tf.data.Dataset.from_generator()</code> stubbornly converts date strings to bytes causing the generator function to fail. Let me demo... | <python><tensorflow><dataset> | 2023-03-18 12:36:33 | 1 | 2,713 | mac13k |
75,775,892 | 12,023,442 | FlightSql works on Linux but fails on Windows with error | <p>The below code works fine on Linux OS from colab</p>
<pre><code>from flightsql import FlightSQLClient
from urllib.parse import urlparse
parsed_uri = urlparse('https://us-east-1-1.aws.cloud2.influxdata.com' )
bucket_name="VLBA"
host_name=parsed_uri.hostname
data_frame_measurement_name="UnitPrice"... | <python><influxdb><pyarrow> | 2023-03-18 12:24:30 | 1 | 2,254 | ArunJose |
75,775,880 | 6,245,473 | How do I get a dataframe to write all data pulled to csv and not skip any rows with missing data? | <p>The following is working great for hundreds of stocks. But some stocks have incomplete data. E.g., blank <code>shortRatio</code> amount, etc. When that happens, it skips the entire row instead of just leaving certain fields blank. For example, out of <code>symbols = ['AI', 'AG', 'MA']</code>, only <code>'MA'</co... | <python><pandas><dataframe><csv><yfinance> | 2023-03-18 12:22:48 | 1 | 311 | HTMLHelpMe |
75,775,682 | 10,765,455 | Read long single-line text file to JSON | <p>I have a long single-line text file looking like this:</p>
<pre><code>{"attributes":{"fieldAttrs":"{\"request_querystring\":{\"count\":6},\"server_duration\":{
...
"version":"iidfwu83"}
</code></pre>
<p>That spans one single line in a text ... | <python><json> | 2023-03-18 11:48:10 | 0 | 1,621 | Tristan Tran |
75,775,641 | 5,908,918 | AWS Lambda error when adding a layer for snowflake-connector-python package | <p>I am trying to implement a python lambda function that would connect to a Snowflake database. To do that, I need to create a layer for snowflake-connector-python, so I create a zip package of this layer on my Jenkins pipeline, which runs in an Ubuntu Linux container, python 3.10:</p>
<pre><code>mkdir -p ./python
pyt... | <python><aws-lambda><snowflake-cloud-data-platform><aws-lambda-layers> | 2023-03-18 11:41:59 | 0 | 1,241 | Vin Shahrdar |
75,775,624 | 1,118,780 | Pydantic behaves abnormally | <p>I want to build a Pydantic model in Pydantic version 1.10.2 and python 3.7 with the following fields:</p>
<ul>
<li><code>overWrite</code></li>
<li><code>nas_path</code></li>
<li><code>hdfs_dir</code></li>
<li><code>convert</code></li>
<li><code>file_size_limit</code></li>
</ul>
<p>with these conditions:</p>
<ol>
<li... | <python><pydantic> | 2023-03-18 11:39:22 | 1 | 2,596 | burning |
75,775,587 | 755,371 | Python poetry Failed to clone verify ref exists on remote | <p>I am using poetry 1.4.0 on ubuntu 22.04, and trying to add a specific git branch into my project :</p>
<pre><code>poetry add git+ssh://git@dev/home/git/projects/jaydebeapi#nanosecond_fix
Failed to clone ssh://git@dev/home/git/projects/jaydebeapi at 'nanosecond_fix', verify ref exists on remote.
</code></pre>
<p>Thi... | <python><git><python-poetry> | 2023-03-18 11:31:44 | 2 | 5,139 | Eric |
75,775,559 | 7,168,244 | Include notes in seaborn barplot | <p>I have a barplot that I would like to include a note at the bottom.
The current code is shown below</p>
<pre><code>import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from matplotlib.ticker import PercentFormatter
data = {
'id': [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8,... | <python><pandas><matplotlib><seaborn><plot-annotations> | 2023-03-18 11:27:18 | 2 | 481 | Stephen Okiya |
75,775,511 | 10,620,788 | Get the stardard error from linear regression model in pySpark | <p>I have the following code to perform a linear regression on pySpark:</p>
<pre><code>lr = LinearRegression(featuresCol = 'features', labelCol='units_sold', maxIter=10, regParam=0.3, elasticNetParam=0.8)
lr_model = lr.fit(premodel_df)
summary =lr_model.summary
</code></pre>
<p>I am trying to get the standard error fro... | <python><apache-spark><pyspark><linear-regression> | 2023-03-18 11:17:49 | 1 | 363 | mblume |
75,775,413 | 2,261,553 | Slow performance of Python multiprocessing when run under SLURM | <p>I am running a Python code that employs <code>multiprocessing</code> for parallel tasks. When I run this on my local machine, everything works as expected, but when I use a cluster of 2x AMD with 64 cores per node, everything slows down significantly. I am using SLURM for the batch execution, <strong>and I want to r... | <python><multiprocessing><slurm> | 2023-03-18 10:58:20 | 0 | 411 | Zarathustra |
75,775,315 | 12,466,687 | What is the polars equivalent of converting a numeric (Year) column to date in python? | <p>I am new to <code>polars</code> and have been trying to convert just <code>Year</code> column to <code>date</code> column but failed to do so.</p>
<p><strong>Data</strong></p>
<pre><code>import polars as pl
import pandas as pd
import datetime as dt
import plotly.express as px
# creating pandas df
df_gapminder = px.... | <python><date><datetime><python-polars> | 2023-03-18 10:36:57 | 1 | 2,357 | ViSa |
75,775,189 | 401,041 | How to access RDP Active X AdvancedSettings2 using PytQT5 QAxWidget? | <p>I am trying to implemente a remote desktop client using PyQt5 QAxWidget to expose an MsRdpClient10NotSafeForScripting ActiveX object.</p>
<p>The connection works but I can't figure how to access the AdvancedSettings2 interface.</p>
<pre class="lang-py prettyprint-override"><code>import sys
from PyQt5.QtWidgets impor... | <python><pyqt5><activex><remote-desktop> | 2023-03-18 10:13:05 | 1 | 5,647 | João Pinto |
75,775,141 | 12,466,687 | How to mention custom daterange using polars Dataframe in python plotly plots? | <p>I am new to python <code>polars</code> and trying to create a <code>line plot</code> using <code>plotly express</code> with <code>custom start date</code> & <code>max date</code> as the x-axis date range of the plot.</p>
<p><strong>Doubt</strong>: Do I need to pass the whole <code>polars dataframe</code> again i... | <python><plotly><python-polars> | 2023-03-18 10:04:49 | 1 | 2,357 | ViSa |
75,774,873 | 13,266,105 | OpenAI API error: "This is a chat model and not supported in the v1/completions endpoint" | <pre><code>import discord
import openai
import os
openai.api_key = os.environ.get("OPENAI_API_KEY")
#Specify the intent
intents = discord.Intents.default()
intents.members = True
#Create Client
client = discord.Client(intents=intents)
async def generate_response(message):
prompt = f"{message.aut... | <python><discord><openai-api><chatgpt-api> | 2023-03-18 09:11:27 | 9 | 527 | RAFA 04128 |
75,774,838 | 10,284,437 | How to implement the callback URL for 'Upwork' REST API? | <p>To be able to run this code (search jobs from upwork.com):</p>
<pre><code>#!/usr/bin/env python
import upwork
from upwork.routers.jobs import search
# https://developers.upwork.com/?lang=python#authentication_authorization-request
# https://www.upwork.com/developer/keys/apply
config = upwork.Config(
{
... | <python><php><rest><upwork-api> | 2023-03-18 09:05:11 | 1 | 731 | Mévatlavé Kraspek |
75,774,747 | 1,497,720 | Avro Json for Kafka Provider | <p>For the following code I got error at line
<code>value_serializer=lambda m: io.DatumWriter(avro_schema).write(m).bytes()</code>
saying
<code>TypeError: write() missing 1 required positional argument: 'encoder'</code>
what should be the write syntax for avro write?</p>
<pre><code>import os
import json
import time
imp... | <python><apache-kafka><avro> | 2023-03-18 08:46:56 | 1 | 18,765 | william007 |
75,774,699 | 10,266,998 | problem in skiping a line in the text file | <p>I have a code which takes backup from my cisco switches. It reads a text file containing switches' IPs line by line, connect to each IP and takes backup from that switch. Here is the code:</p>
<pre><code>import sys
import time
import paramiko
import os
import cmd
import datetime
now = datetime.datetime.now()
user ... | <python> | 2023-03-18 08:36:11 | 1 | 535 | Pablo |
75,774,683 | 13,670,175 | "errorMessage": "[Errno 30] Read-only file system: '/home/sbx_user1051'", Python Selenium on AWS Lambda | <p>I am trying to run selenium python on AWS Lambda. But when I try to execute it from the console, I get the following error.</p>
<pre><code>{
"errorMessage": "[Errno 30] Read-only file system: '/home/sbx_user1051'",
"errorType": "OSError",
"requestId": "820... | <python><amazon-web-services><selenium-webdriver><aws-lambda> | 2023-03-18 08:32:37 | 0 | 335 | Umakanth Pendyala |
75,776,067 | 9,481,613 | In Python RSA broadcast attack, why am I using bit length in this binary search for the cube root? | <p><a href="https://stackoverflow.com/a/23622115/9481613">https://stackoverflow.com/a/23622115/9481613</a></p>
<p>Shows this function:</p>
<pre><code>def find_cube_root(n):
lo = 0
hi = 1 << ((n.bit_length() + 2) // 3)
while lo < hi:
mid = (lo+hi)//2
if mid**3 < n:
lo ... | <python><rsa><bisection> | 2023-03-18 08:31:00 | 1 | 1,171 | mLstudent33 |
75,774,357 | 1,033,591 | Can I pass variables to the compare function in sorted method in Python? | <p>Here is the code:</p>
<pre><code> if(order=="dsc"):
return sorted(qs, key=compare_function, reverse=True)
elif (order=="asc"): # asc
# return sorted(qs, key=lambda obj: obj.teacher.name)
return sorted(qs, key=compare_function)
else:
pass
def compare_f... | <python> | 2023-03-18 07:08:32 | 1 | 2,147 | Alston |
75,774,350 | 6,251,742 | Special case when += for string concatenation is more efficient than = | <p>I have this code using python 3.11:</p>
<pre class="lang-py prettyprint-override"><code>import timeit
code_1 = """
initial_string = ''
for i in range(10000):
initial_string = initial_string + 'x' + 'y'
"""
code_2 = """
initial_string = ''
for i in range(10000):
... | <python><string><concatenation><string-concatenation><python-3.11> | 2023-03-18 07:07:24 | 2 | 4,033 | Dorian Turba |
75,774,293 | 18,356,681 | Please set buildPython to your Python executable path. error | <p>I am trying to make some code in python and run it in to android studio and I got this error. I don't know how to solve this.</p>
<p><strong>My main Activity</strong></p>
<pre><code> class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedIns... | <python><android><android-studio><chaquopy> | 2023-03-18 06:55:33 | 1 | 338 | heet kanabar |
75,774,025 | 3,009,657 | How to generate custom table using python reportalab | <p>I have the below data frame, I am trying to generate a report in a table format with this data.</p>
<pre><code>import pandas as pd
data = {'MonthString': ['January', 'February', 'March'],
'sachin': [98.08, 99.27, 100.00],
'saurav': ['96.77', '99.85', '98.86']}
df = pd.DataFrame(data)
</code></pre>
<p... | <python><python-3.x><reportlab> | 2023-03-18 05:27:32 | 2 | 987 | Hound |
75,773,966 | 17,973,259 | Code refactoring in a game made with Python and pygame | <p>As I kept building my game, I started to notice that I was putting all the methods in the main class and it got too big and hard to follow. I started to refactor it into multiple modules / classes and for example I created a new module called 'game_collisions' and a class named CollisionManager, and in that class I ... | <python><class><oop><methods> | 2023-03-18 05:01:44 | 1 | 878 | Alex |
75,773,844 | 132,438 | read a .7z file in memory with Python, and process each line as a stream | <p>I'm working with a huge .7z file that I need to process line by line.</p>
<p>First I tried <code>py7zr</code>, but it only works by first decompressing the whole file into an object. This runs out of memory.</p>
<p>Then <code>libarchive</code> is able to read block by block, but there's no straightforward way of spl... | <python><string><7zip><in-memory><libarchive> | 2023-03-18 04:18:30 | 1 | 59,753 | Felipe Hoffa |
75,773,791 | 10,284,437 | Selenium: scroll down, then no more links than previous state | <p>I have this code, I know it scroll down very well in non headless mode.</p>
<pre><code>lenght = 0
last = 0
full_items_list_temp = []
# scroll down code. Number of links is 25
while True:
html = driver.find_element(By.TAG_NAME, 'html')
html.send_keys(Keys.END)
full_items_list_temp = self.driver.find_elem... | <python><selenium-webdriver><selenium-chromedriver> | 2023-03-18 04:01:15 | 1 | 731 | Mévatlavé Kraspek |
75,773,786 | 9,680,491 | Why can't I access GPT-4 models via API, although GPT-3.5 models work? | <p>I'm able to use the gpt-3.5-turbo-0301 model to access the ChatGPT API, but not any of the gpt-4 models. Here is the code I am using to test this (it excludes my openai API key). The code runs as written, but when I replace "gpt-3.5-turbo-0301" with "gpt-4", "gpt-4-0314", or "gpt-4... | <python><openai-api><gpt-4> | 2023-03-18 03:59:30 | 4 | 403 | Autodidactyle |
75,773,580 | 21,370,799 | Why isn't my if statement functioning properly in Python? | <p>So I was doing an experiment where a user enters a text and the program responds according to the condition. If the condition returns false, then the program prints the message "IDK". But when I ran it, I got the proper response and below it, I got the "IDK" message. What should I do to solve it?... | <python><if-statement><conditional-statements> | 2023-03-18 02:48:34 | 1 | 441 | lunix |
75,773,430 | 37,213 | Problem With Scikit Learn One Hot and Ordinal Encoders | <p>I'm having a problem with Scikit Learn's one-hot and ordinal encoders that I hope someone can explain to me.</p>
<p>I'm following along with a <a href="https://towardsdatascience.com/guide-to-encoding-categorical-features-using-scikit-learn-for-machine-learning-5048997a5c79" rel="nofollow noreferrer">Towards Data Sc... | <python><pandas><machine-learning><scikit-learn><pipeline> | 2023-03-18 01:56:12 | 2 | 309,526 | duffymo |
75,773,377 | 10,107,738 | How do I crawl a page to the href elements using scrapy? | <p>I am trying to crawl a page and print the <code>hrefs</code>, however I am not getting any response. Here is the spider -</p>
<pre class="lang-py prettyprint-override"><code>import scrapy
from scrapy.linkextractors import LinkExtractor
from scrapy.spiders import CrawlSpider, Rule
class Shoes2Spider(CrawlSpider):
... | <python><scrapy><web-crawler> | 2023-03-18 01:34:49 | 2 | 939 | The Rookie |
75,773,353 | 19,425,874 | How to export full Google Sheet tab as PDF and then print to local printer using Python | <p>After several weeks, I'm getting very close into solving my overall issue. I'm looking to connect my Google Sheet to a local printer & print the tabs "Label" and "Claims". Label needs to be printed x times, x being defined by the value in cell f2. Claims should be printed once as well.</p>
... | <python><canvas><operating-system><pywin32><reportlab> | 2023-03-18 01:25:09 | 1 | 393 | Anthony Madle |
75,773,259 | 14,729,820 | How to convert date and time inside data frame to float64 datatype? | <p>I have this Excel file <a href="https://github.com/Mohammed20201991/DataSets/blob/main/data.xlsx" rel="nofollow noreferrer">data</a>
as in the image below <img src="https://i.sstatic.net/kbI7C.png" alt="enter image description here" />] following this <a href="https://kgptalkie.com/multi-step-time-series-predicting-... | <python><pandas><dataframe><data-science> | 2023-03-18 00:51:01 | 2 | 366 | Mohammed |
75,773,245 | 2,024,493 | Take snapshots of Youtube videos to create a preview GIF programatically | <p>I use the Youtube API to integrate content into my site. But, it doesn't provide any good snapshots of the videos. It provides a few very low quality snapshots that are virtually unusable.</p>
<pre><code>https://img.youtube.com/vi/<insert-youtube-video-id-here>/0.jpg
https://img.youtube.com/vi/<insert-youtu... | <python><php><gif> | 2023-03-18 00:46:58 | 2 | 2,010 | Maciek |
75,773,088 | 1,241,786 | What can I do to improve the performance of a simple string search and replace script? | <p>I have a spreadsheet that contains 2 columns, the 1st is a column of strings that I need to search for, and the 2nd is a column of strings that the 1st column needs to be replaced with. There are close to 4000 rows in this spreadsheet. I have an example of the data shown below.</p>
<p>All of the strings in the "... | <python> | 2023-03-18 00:00:22 | 1 | 728 | kubiej21 |
75,773,085 | 4,258,228 | subprocess.run(["huggingface-cli", "login", "--token", TOKEN]) works on mac but not on Ubuntu | <p>I am tring to run <code>subprocess.run(["huggingface-cli", "login", "--token", TOKEN])</code> in a Jupyter notebook, which works on Mac but gets the following error on Ubuntu. I checked that <code>pip install huggingface_hub</code> has been executed.</p>
<p><code>subprocess.run(["g... | <python><ubuntu><subprocess> | 2023-03-18 00:00:03 | 3 | 417 | dami.max |
75,773,019 | 743,730 | What exceptions can be raised by Python HTTPX's json() method? | <p>The excellent <a href="https://www.python-httpx.org" rel="nofollow noreferrer">Python HTTPX package</a> has a <a href="https://www.python-httpx.org/quickstart/#json-response-content" rel="nofollow noreferrer"><code>.json()</code></a> method for conveniently decoding resposnes that are in JSON format. But the documen... | <python><httpx> | 2023-03-17 23:43:32 | 1 | 2,489 | mhucka |
75,772,871 | 4,790,871 | Custom endpoint for `ros3` driver in `h5py` | <p><code>h5py</code> supports the native S3 driver for HDF5 (the <code>ros3</code> driver). We've enabled this with a local build of <code>HDF5</code>.</p>
<pre><code>>>> import h5py
>>>
>>> print(f'Registered drivers: {h5py.registered_drivers()}')
Registered drivers: frozenset({ 'ros3', 'se... | <python><amazon-s3><hdf5><h5py><ceph> | 2023-03-17 23:06:37 | 1 | 32,449 | David Parks |
75,772,788 | 9,415,280 | tensorflow with custom training loop and tf.data.dataset | <p>I'm trying to build a Tensorflow model with custom training loop to use the forecast to feed the inputs of the next time step. The model has two heads and inputs set. I got problem to find how to pass my two inputs and manage how to deal with the custom call function.</p>
<p>I use this ref to build my code:
<a href=... | <python><tensorflow><tensorflow-datasets> | 2023-03-17 22:47:17 | 0 | 451 | Jonathan Roy |
75,772,718 | 10,646,643 | Running "python setup.py install" second time fails with [WinError 32] error message | <p>Trying to install several well-established Python modules from the source using "python setup.py install" command on Windows running Python 3.11. Everything works during the first run, no error messages. However, when running the same command second time (for no practical reason, just trying to make sure t... | <python><setup.py> | 2023-03-17 22:33:22 | 0 | 648 | Regus Pregus |
75,772,707 | 1,074,593 | How to compare two columns in Excel using Python? | <p>I have to excel files with the following fields<br />
<strong>file1</strong><br />
col1,col2,col3,col4,col5,col6,col7,col8,col9</p>
<p>server1,java_yes,....<br />
server2,java_no,....<br />
server4,java_no,....<br />
server8,java_no,....</p>
<p><strong>file2</strong><br />
col1,col2,col3,col4,col5,col6,col7,col8,col... | <python><excel><numpy> | 2023-03-17 22:31:41 | 2 | 660 | user1074593 |
75,772,510 | 20,736,637 | Selenium Stale elements in Python | <p>I am trying to complete a problem involved in Angela's '100 Days of Python' course.</p>
<p>It involves building a cookie clicker website that <strong>uses selenium</strong> to <strong>click the cookie</strong> from** <a href="http://orteil.dashnet.org/experiments/cookie/" rel="nofollow noreferrer">http://orteil.dash... | <python><selenium-webdriver><staleelementreferenceexception> | 2023-03-17 21:52:20 | 2 | 636 | Daniel Crompton |
75,772,275 | 7,903,749 | How to suppress the `RemovedInDjango40Warning` warnings in a unit test? | <p>We are working on a unit test in PyCharm and the test itself is passing now. However, the terminal output contains warning messages in the <code>RemovedInDjango40Warning</code> category. As we do not plan to upgrade to Django 4.0 for now, these warnings are verbose and distracting.</p>
<p>We tried including the stat... | <python><django><pycharm><warnings> | 2023-03-17 21:13:19 | 1 | 2,243 | James |
75,772,170 | 19,980,284 | Produce Predictive Margins in Statsmodels Output for Logistic Regression | <p>I've used the <code>get_margeff()</code> function to try to generate margins for a logit model I've run. Here is the data and code:</p>
<pre class="lang-py prettyprint-override"><code>model_5a_1 = smf.logit('''fluid ~ C(examq3_n, Treatment(reference = 2.0)) + C(pmhq3_n) + C(fluidq3_n) + C(mapq3_n, Treatment(referenc... | <python><stata><logistic-regression><statsmodels> | 2023-03-17 20:56:56 | 1 | 671 | hulio_entredas |
75,772,148 | 5,833,797 | Python - pip install private repo in remote environment | <p>I am using a private Github repo in my project as a library. This works fine in my local environment but when I push this to a remote host, it won't install because the remote host doesn't have access to the repo.</p>
<p>Adding the credentials to the url like this works fine:
git+https://${GITHUB_USER}:${GITHUB_TOKE... | <python><github><pip> | 2023-03-17 20:54:17 | 1 | 727 | Dave Cook |
75,772,015 | 595,305 | Make use of a patch set up by an autouse fixture? | <p>Follows on from <a href="https://stackoverflow.com/a/38763328/595305">this answer</a> about disabling autouse fixtures.</p>
<p>If I have this fixture</p>
<pre><code>@pytest.fixture(autouse=True)
def mock_logger_error(request):
with mock.patch('logging.Logger.error') as mock_error:
yield
</code></pre>
<p>... | <python><mocking><pytest><patch><fixtures> | 2023-03-17 20:34:58 | 2 | 16,076 | mike rodent |
75,771,920 | 9,422,114 | Python: regex pattern fails after being split into multiple lines | <p>I have a regex pattern that works fine if I write it in a single line.</p>
<p>For instance, the pattern work if I do the following:</p>
<pre><code>MAIN_TREE_START_STRING_PATTERN = (
r"\*{3}\s+\bTotal Things\b:\s+(?P<number_of_things>\d+)"
)
compiled_pattern = re.compile(MAIN_TREE_START_STRING_PAT... | <python><python-3.x><regex><python-re> | 2023-03-17 20:22:03 | 2 | 1,401 | Jacobo |
75,771,896 | 11,501,370 | Get Geometric Mean Over Window in Pyspark Dataframe | <p>I have the following pyspark dataframe</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>Car</th>
<th>Time</th>
<th>Val1</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>1</td>
<td>3</td>
</tr>
<tr>
<td>2</td>
<td>1</td>
<td>6</td>
</tr>
<tr>
<td>3</td>
<td>1</td>
<td>8</td>
</tr>
<tr>
<td>... | <python><pyspark> | 2023-03-17 20:18:54 | 2 | 369 | DataScience99 |
75,771,824 | 2,878,290 | How to Expose Delta Table Data or Synapse Table to Rest API Service using Java/python | <p>We would like to expose the data from delta table or synapse table to REST API service which is java based or either python language. kindly provide sample for java or python to kick start my new implementation.</p>
<p>Thanks</p>
| <python><java><web-services><azure-databricks><delta-lake> | 2023-03-17 20:09:28 | 1 | 382 | Developer Rajinikanth |
75,771,782 | 5,527,646 | Listing All Lambda Functions using AWS SDK for Python (boto3) | <p>I am trying to use <code>boto3</code> to get a list of all the lambdas I have in AWS. I will also need to get metrics from these lambdas (metrics are enabled in AWS console) but presently I just want to list them all. In addition, I just want to get the lambdas based on a filtered tag (ex: get all the lambdas with t... | <python><amazon-web-services><aws-lambda><boto3> | 2023-03-17 20:04:51 | 1 | 1,933 | gwydion93 |
75,771,627 | 10,983,470 | How to install pytorch for cpu with conda from tar.bz2 sources on Windows? | <p>There are many question related to <code>pytorch</code> installation, I am aware. So far none combines all my requirements and their solutions don't work on that case :</p>
<p>I need to install torch on an isolated-Windows-with-cpu-only environment that can not access internet. Ideally the solution will use <code>co... | <python><pytorch> | 2023-03-17 19:44:46 | 1 | 1,783 | cbo |
75,771,565 | 7,190,421 | Trying to remove all occurances of a few patterns from a list | <p>So I have a list, something like this:</p>
<p><code>check = ['10.92.145.17/29', '10.92.145.25/29', '10.45.33.109/32', '10.202.1.113/32', '10.202.1.119/32', '10.202.1.122/32', '10.202.1.124/32', '10.202.1.126/32', '10.202.1.130/32', '10.202.1.132/32', '10.202.1.135/32', '10.202.1.136/32', '10.202.1.137/32', '10.202.1... | <python> | 2023-03-17 19:36:15 | 5 | 325 | Yogesh Sudheer Modak |
75,771,422 | 1,687,652 | One entry point in WORKSPACE for managing various python project requirements | <p>My Bazel project structure is like this</p>
<pre><code>├── BUILD
├── WORKSPACE
├── example.py
├── reqs.bzl
└── requirements.txt
</code></pre>
<p>I have created my <code>WORKSPACE</code> like this</p>
<pre><code>load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
... | <python><bazel><bazel-python> | 2023-03-17 19:20:14 | 1 | 561 | a k |
75,771,289 | 726,802 | Issue while trying to run data script in django | <p>I have already checked this post but of no use for me.</p>
<p><a href="https://stackoverflow.com/questions/16230487/module-object-is-not-callable-django">'module' object is not callable Django</a></p>
<pre><code>from auth_app.models import UserModel
from django.contrib.auth.hashers import make_password
def ... | <python><django> | 2023-03-17 19:02:15 | 2 | 10,163 | Pankaj |
75,771,263 | 3,826,115 | Link DynamicMap to two streams in Holoviews | <p>I have the following code that does mostly what I want it to do: make a scatter plot colored by a value, and a linked DynamicMap that shows an associated timeseries with each Point when you tap on it</p>
<pre><code>import pandas as pd
import holoviews as hv
import panel as pn
from holoviews import streams
import ... | <python><bokeh><holoviews> | 2023-03-17 18:59:15 | 1 | 1,533 | hm8 |
75,771,210 | 577,652 | Create a generic logger for function start and finish time in Python | <p>I want to create a logger decorator that will print before and after a function, in addition I want to add some information that if avaiable will appear in each line, for example most of our current logs look like:</p>
<pre><code>START: reading_data product_id=123, message_id=abc, timesteamp=123456789
</code></pre>
... | <python><python-decorators><python-logging> | 2023-03-17 18:53:47 | 2 | 726 | shlomiLan |
75,771,154 | 19,980,284 | Is it necessary to add a constant to a logit model run on categorical variables only? | <p>I have a dataframe that looks like this:
<img src="https://i.ibb.co/3zvJjnQ/Screen-Shot-2023-03-17-at-2-39-34-PM.png" alt="" /></p>
<p>And am running a logit model on fluid as dependent variable, and excluding <code>vp</code> and <code>perip</code>:</p>
<pre class="lang-py prettyprint-override"><code>model = smf.log... | <python><pandas><logistic-regression><statsmodels> | 2023-03-17 18:47:07 | 1 | 671 | hulio_entredas |
75,771,076 | 553,003 | Importing script from local package during setuptools CustomInstall | <p>I have the following setup:</p>
<pre><code>`- MyLibrary
`- pyproject.toml
`- setup.cfg
`- setup.py
`- Package1
`- ...
`- Package2
`- ...
`- CodeGen
`- __init__.py
`- Generate.py
</code></pre>
<p>and I need the install script to run a <code>generate()</code> function from <code>CodeGen.Gen... | <python><python-import><setuptools><setup.py><python-packaging> | 2023-03-17 18:38:19 | 0 | 9,477 | Ptival |
75,771,075 | 10,754,437 | Run Python script in isolation | <p>I need to run a Python script from within bash in a way so it does <strong>not</strong> have access to any environment variables or system files/configurations. This due to an AWS boto3 client that tries to read configuration information from the environment and/or a config file.</p>
<p>Searching only results in how... | <python><python-3.x><bash> | 2023-03-17 18:38:15 | 1 | 2,597 | SecretIndividual |
75,771,046 | 6,348,055 | Boto3 Dynamodb list_append Invalid type for parameter ExpressionAttributeNames type: <class 'set'>, valid types: <class 'dict'> | <p>Error message is throwing me. I have update_item updating an existing list. When I put everything in the UpdateExpression, it works fine. When I use the equivalent with ExpressionAttributeNames, I get the error in the title. They look equivalent to me, but hopefully someone can point out my error.</p>
<p>This wo... | <python><amazon-web-services><amazon-dynamodb><boto3> | 2023-03-17 18:35:37 | 1 | 307 | Couch |
75,770,930 | 2,590,824 | post request to SOLR in json format with facet using python returns response 400 (Unknown top-level key in JSON request : facet.field) | <p>I am using python (Django) to post requests to SOLR (9.0.0) in json format (<a href="https://solr.apache.org/guide/8_1/json-request-api.html" rel="nofollow noreferrer">JSON request API</a>) to retrieve the data. When using faceting, I am facing a problem probably due to json format of the request. Can anyone please ... | <python><json><post><solr><facet> | 2023-03-17 18:21:00 | 2 | 7,999 | sariDon |
75,770,878 | 7,535,556 | Filter text in PDF by font with Borb using regex | <p>I am trying to extract text using Borb from a PDF and i can see there is a clear example to extract text with font names:</p>
<pre><code> # create FontNameFilter
l0: FontNameFilter = FontNameFilter("Helvetica")
# filtered text just gets passed to SimpleTextExtraction
l1: SimpleTextExtractio... | <python><pdf-extraction><borb> | 2023-03-17 18:13:08 | 1 | 357 | IamButtman |
75,770,801 | 1,813,491 | Pydantic does not validate as expected in a simple model | <p>I am first time learning pydantic, using this example. But I don't get any exception message as I expect, and the class has been made. What's the problem here?
I am using pedantic 0.18.2 on python 3.8.10 in a notebook in VScode environment:</p>
<p>from pydantic import BaseModel, ValidationError</p>
<pre><code>from p... | <python><python-3.x><pydantic> | 2023-03-17 18:04:50 | 0 | 431 | BobbyF |
75,770,780 | 3,123,109 | Returning queryset that uses a foreign key of a foreign key relationship | <p>It sounds simple enough: get all the Users for a specific Company. But it is complicated by a few things:</p>
<ul>
<li>The User model is extended</li>
<li>The model that extends it contains a UUID that uniquely identifies the user throughout various system integrations</li>
<li>This UUID is what is used in the compa... | <python><django><django-models><django-rest-framework><django-viewsets> | 2023-03-17 18:02:09 | 2 | 9,304 | cheslijones |
75,770,564 | 900,078 | Why "from . import re" fails but "import re; from . import re" succeeds? | <p>I'm playing with Python's relative import and the following result (with <strong>Python 3.7.3</strong> on Debian 10.12) surprises me:</p>
<pre class="lang-none prettyprint-override"><code>$ python3
>>> from . import re
Traceback (most recent call last):
File "<stdin>", line 1, in <modul... | <python><python-3.x> | 2023-03-17 17:33:23 | 1 | 21,248 | pynexj |
75,770,303 | 9,226,093 | Get name of class from class type in python | <p>Given a class type, I'd like to get its name and print it to console. I have access to the class type but not an instance.</p>
<pre><code>class Foo:
pass
def print_class_names(klass):
print(klass.__some_dunder?__) # don't know how to do this
print_class_name(Foo) # would like this to print "Foo"
</c... | <python><python-3.x><typing> | 2023-03-17 17:01:59 | 0 | 776 | jacob_g |
75,770,293 | 1,800,838 | Python YAML *not* preserving order in lists | <p>We're using PyYAML version 5.3.1 under Python 3.7.</p>
<p>We're finding that the order of lists is not being preserved.</p>
<p>For example, assume that in the file <code>example.yaml</code>, we have the following ...</p>
<pre><code>---
data:
- start
- next
...
</code></pre>
<p>And suppose that our Python 3.7 pro... | <python><list><yaml> | 2023-03-17 17:01:09 | 0 | 2,350 | HippoMan |
75,770,281 | 12,042,094 | Azure DataBricks ImportError: cannot import name dataclass_transform | <p>I have a python notebook running the following imports on a DataBricks cluster</p>
<pre><code>%pip install presidio_analyzer
%pip install presidio_anonymizer
import spacy.cli
spacy.cli.download("en_core_web_lg")
nlp = spacy.load("en_core_web_lg")
import csv
import pprint
import collections
from t... | <python><azure><azure-data-factory><databricks><presidio> | 2023-03-17 17:00:05 | 2 | 486 | RAH |
75,770,248 | 2,373,145 | Eager map in Python | <p>In Python the <code>map</code> function is lazy, but most often I need an eager map.</p>
<p>For example, trying to slice a map object results in an error:</p>
<pre><code>>>>> map(abs, [3, -1, -4, 1])[1:]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeEr... | <python><python-3.x><functional-programming><lazy-evaluation><lazy-sequences> | 2023-03-17 16:56:31 | 1 | 363 | user2373145 |
75,770,169 | 470,062 | How do I check that an object is a class definition (In Python 3)? | <p>The following code Prints <code>False</code>:</p>
<pre><code>from enum import Enum
type_ = str
print(issubclass(type_, Enum))
</code></pre>
<p>The following code prints <code>True</code>:</p>
<pre><code>from enum import Enum
type_ = Enum('MyEnum', {'a': 1, 'b': 2})
print(issubclass(type_, Enum))
</code></pre>
<p>The... | <python><python-3.x> | 2023-03-17 16:48:15 | 0 | 7,891 | tofarr |
75,770,005 | 11,594,202 | Mapping class methods of python class | <p>I created a message class, which stores an arbitrary message like so:</p>
<pre><code>class MessageBase:
"""Wrapper class for messages from different resources"""
def __init__(
self,
subject,
body,
sender,
recipient,
recei... | <python><python-class> | 2023-03-17 16:29:21 | 2 | 920 | Jeroen Vermunt |
75,769,948 | 17,741,308 | Tensorflow-datasets "plant_village" dataset no examples were yield | <p>My Environment:</p>
<p>Python 3.11.2, Tensorflow 2.12.0-rc1, Tensorflow-datasets 4.8.3, perfect clean newly created virtual environment in Visual Studio Code with the only operations performed being pip install the two libraries above .</p>
<p>The import statements :</p>
<pre><code>import tensorflow as tf
import ten... | <python><python-3.x><tensorflow><tensorflow2.0><tensorflow-datasets> | 2023-03-17 16:23:07 | 2 | 364 | 温泽海 |
75,769,839 | 5,410,188 | Python - Pillow - Can't save resized image - Error seek of closed file | <p>I've been at this for a couple of hours. I'm trying to resize an image via pillow and save it but I continue to get the error <code>Error seek of closed file</code> and I'm not sure why. I've looked at numerous tutorials and it seems to work fine for them. When I run in the ipython shell, with <code>.show()</code> i... | <python><python-imaging-library><image-resizing> | 2023-03-17 16:10:31 | 1 | 1,542 | Cflux |
75,769,820 | 6,734,243 | How to prevent matplotlib to be shown in popup window? | <p>I use matplotlib in my lib to display legend on a ipyleaflet map. In my CD/CI tests I run several checks on this legend (values displayed, colors etc...). My problem is when it's run on my local computer, matplotlib open a legend popup windows that stops the execution of the tests.</p>
<p>Is it possible to force mat... | <python><matplotlib> | 2023-03-17 16:08:51 | 1 | 2,670 | Pierrick Rambaud |
75,769,816 | 10,028,567 | How do I retrieve a password from Keychain Access using keyring? | <p>"Keeping credentials safe in Jupyter Notebooks" (<a href="https://towardsdatascience.com/keeping-credentials-safe-in-jupyter-notebooks-fbd215a8e311" rel="nofollow noreferrer">https://towardsdatascience.com/keeping-credentials-safe-in-jupyter-notebooks-fbd215a8e311</a>) says that "Keyring integrates wi... | <python><jupyter-lab><keychain><python-keyring> | 2023-03-17 16:08:22 | 0 | 437 | Tom Lever |
75,769,777 | 2,783,767 | how to save best model in timeseries tsai | <p>I am using tsai TSCLassifier to train on my data.
However I donot know how to save the best model of all epochs.Like there is modelcheckpoint in keras/tensorflow. Among all epochs I want to save the model that is best val_loss on test set.</p>
<p>Below is my code, can somebody please help to let me know how to save ... | <python><deep-learning><time-series> | 2023-03-17 16:04:16 | 1 | 394 | Granth |
75,769,692 | 1,627,466 | Selective replacement of unicode characters in Python using regex | <p>There are many answers as to how one can use regex to remove unicode characters in Python.</p>
<p>See <a href="https://stackoverflow.com/questions/44010727/remove-unicode-code-uxxx-in-string-python">Remove Unicode code (\uxxx) in string Python</a> and <a href="https://stackoverflow.com/questions/70377962/python-rege... | <python><regex><unicode> | 2023-03-17 15:54:56 | 2 | 423 | user1627466 |
75,769,639 | 2,482,149 | Boto3- Type Hint For an S3 Bucket Resource | <p>I have instantiated an s3 bucket using boto3 below:</p>
<pre><code>import boto3
session = boto3.Session()
s3 = session.resource('s3')
src_bucket = s3.Bucket('input-bucket')
</code></pre>
<p>Then I created a function passing in said bucket in order to return the number of objects in it:</p>
<pre><code>def get_total... | <python><amazon-s3><boto3> | 2023-03-17 15:49:12 | 2 | 1,226 | clattenburg cake |
75,769,461 | 14,705,072 | How to fill a polars dataframe from a numpy array in python | <p>I am currently working on a dataframe function that assigns values of a numpy array of shape 2 to a given column of a dataframe using the polars library in Python.</p>
<p>I have a dataframe <code>df</code> with the following columns : <code>['HZ', 'FL', 'Q']</code>. The column <code>'HZ'</code>takes values in <code>... | <python><numpy><python-polars> | 2023-03-17 15:32:38 | 1 | 319 | Haeden |
75,769,364 | 3,971,855 | Doing a groupby only on common column values | <p>I have a query on how to do groupby on the values which are common to the keys on which we are doing a groupby. Its very hard for me to describe the exact problem in words.</p>
<p>I have the table below in this format.</p>
<p><a href="https://i.sstatic.net/5J9ZN.png" rel="nofollow noreferrer"><img src="https://i.ss... | <python><pandas><dataframe><group-by> | 2023-03-17 15:23:32 | 1 | 309 | BrownBatman |
75,769,250 | 19,328,707 | Python - Webscraping POST login expired | <p>I'm trying to download a file from an network device. Therefore i need to be logged in to get to the download endpoint.</p>
<p>I copied the <code>POST</code> curl of the login request to the website and converted it to a python request that looks like so.</p>
<pre><code>import requests
headers = {
'User-Agent':... | <python><web-scraping><request> | 2023-03-17 15:12:33 | 1 | 326 | LiiVion |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.