Skip to content Skip to sidebar Skip to footer
Showing posts from June, 2024

Python Datetime.strptime Month Specifier Doesn't Seem To Work

The month format specifier doesn't seem to work. from datetime import datetime endDate = dateti… Read more Python Datetime.strptime Month Specifier Doesn't Seem To Work

How Can I Handle The Code To Avoid Killed?

I got Killed after some running this code part one of the code is def load_data(distance_file): … Read more How Can I Handle The Code To Avoid Killed?

Pandas Better Way For Sorting, Grouping, Summing

New to Pandas so wondering if there is a more Pandithic (coining it!) way to sort some data, group … Read more Pandas Better Way For Sorting, Grouping, Summing

All Possible Replacements Of Two Lists?

(I am aware that the title of the question might be misleading, but I could not find any other way … Read more All Possible Replacements Of Two Lists?

How I Can Make A Copy From Both Blog And Comments In Django?

I want to make a copy from my blog object and its comment. i write some code and it works for blog … Read more How I Can Make A Copy From Both Blog And Comments In Django?

How Do I Print The Results Of My Math Of My Functions? [python Functions] (edited)

I have 3 different small programs that I have no idea how to display them, I've done the math a… Read more How Do I Print The Results Of My Math Of My Functions? [python Functions] (edited)

Typeerror: '<' Not Supported Between Instances - Objects

I am trying to sort by name but it is typing an Error: TypeError: '<' not supported betw… Read more Typeerror: '<' Not Supported Between Instances - Objects

Problems While Using Scikitlearn's Neural Network Implementation

I am trying to implement image processing using Neural Network implementation given by Scikit Learn… Read more Problems While Using Scikitlearn's Neural Network Implementation

Problem With Setting Up Tensorflow On Windows

I installed latest version of tensorflow that is 2.3 and when i try to import tensorflow i get belo… Read more Problem With Setting Up Tensorflow On Windows

Csv To Json With Python, Json In Rows

I would like to covert a CSV to a set of JSON objects with Python, formatted in rows. I tried this … Read more Csv To Json With Python, Json In Rows

Why Is There No Speed-up When Using Pythons Multiprocessing For Embarassingly Parallel Problem Within A For-loop, With Shared Numpy Data?

I want to speed up an embarassingly parallel problem related to Bayesian Inference. The aim is to i… Read more Why Is There No Speed-up When Using Pythons Multiprocessing For Embarassingly Parallel Problem Within A For-loop, With Shared Numpy Data?

Using Sgd Without Using Sklearn (logloss Increasing With Every Epoch)

def train(X_train,y_train,X_test,y_test,epochs,alpha,eta0): w,b = initialize_weights(X_train[0]… Read more Using Sgd Without Using Sklearn (logloss Increasing With Every Epoch)

How Does Subprocess.call Differ From Os.system

I have a python script to install/uninstall some regularly used programs for me and it also does so… Read more How Does Subprocess.call Differ From Os.system

Pip Is Able To Search Package But Install Fails With Error

I have local pypi server, where I uploaded cffi package. When I try to search, it return the packag… Read more Pip Is Able To Search Package But Install Fails With Error

Pygame Event Queue

I would like to know if there is a way of using poll() or get() without removing the events from th… Read more Pygame Event Queue

Parse Table Names From A Bunch Sql Statements

I have an table with thousands of SQL statements in a column called Queries. Any ideas on how to ge… Read more Parse Table Names From A Bunch Sql Statements

How To Make A List Of Lists In Python When It Has Multiple Separators?

The sample file looks like this (all on one line, wrapped for legibility): ['>1\n', … Read more How To Make A List Of Lists In Python When It Has Multiple Separators?

Django-filter: Using Choicefilter With Choices Dependent On Request

I am using django-filter and need to add a ChoiceFilter with choices dependent on the request that … Read more Django-filter: Using Choicefilter With Choices Dependent On Request

Pycrypto Possible To Check If File Already Aes Encrypted?

from Crypto.Cipher import AES def encrypt_file(key, in_filename, out_filename=None, chunksize=… Read more Pycrypto Possible To Check If File Already Aes Encrypted?

Need Python Interface For Moving A Machine To Another Folder

I am trying to find a code support in python for moving a machine between Datacenter's folders … Read more Need Python Interface For Moving A Machine To Another Folder

Python- Positional Argument Follows Keyword Argument

I have a function which accepts variable length of arguments as described below. I am passing the k… Read more Python- Positional Argument Follows Keyword Argument

Matplotlib From Time Series Data Frame

Say I have a data frame like this: from pandas import DataFrame example = {'year_month': … Read more Matplotlib From Time Series Data Frame

Pandas Increment Values On Groupby With A Condition

Lets say I have a df like this, need to groupby on links, and if a link repeated more than 3 times,… Read more Pandas Increment Values On Groupby With A Condition

Applying Pagerank To A Topic Hierarchy Tree(using Sparql Query Extracted From Dbpedia)

As I have a DBpedia query and I want to rank those results by using the PageRank algorithm. Toward … Read more Applying Pagerank To A Topic Hierarchy Tree(using Sparql Query Extracted From Dbpedia)

Python Generator Yields Same Value Each Call

I want this generator to yield the cosine of each successive value from a list, but am getting the … Read more Python Generator Yields Same Value Each Call

Repeat Different Elements Of An Array Different Amounts Of Times

Say I have an array with longitudes, lonPorts lonPort =np.loadtxt('LongPorts.txt',delimiter… Read more Repeat Different Elements Of An Array Different Amounts Of Times

Attributeerror: Module 'os' Has No Attribute 'chroot'

Below is my very basic code running in spyder & python is choking, what am I doing wrong? impor… Read more Attributeerror: Module 'os' Has No Attribute 'chroot'

Pandas.core.groupby.dataframegroupby.idxmin() Is Very Slow , How Can I Make My Code Faster?

i am trying to do same action as SQL group by and take min value : select id,min(value) ,other_fie… Read more Pandas.core.groupby.dataframegroupby.idxmin() Is Very Slow , How Can I Make My Code Faster?

Compare Elements In Two Arrays And Return True When One Value Is Greater Than The Other Using Python

I'm trying to write a for loop in python that compares each ith element in one array px to the … Read more Compare Elements In Two Arrays And Return True When One Value Is Greater Than The Other Using Python

Euler 3 Python. Putting The Prime Numbers Into A List

Im still pretty new to python and I'm trying to get all of the prime numbers from 600851475143 … Read more Euler 3 Python. Putting The Prime Numbers Into A List

'merge' 2 Dataframes On Elements From List?

I want to do the following merge (hard to describe in words): This are my Dataframes df8=pd.DataFra… Read more 'merge' 2 Dataframes On Elements From List?

Apply Custom Function To Groupby In Vaex

I want to apply some custom logic to each individual group obtained by groupby. It is easy to do so… Read more Apply Custom Function To Groupby In Vaex

Is Resume() Function Available In Python 2.7?

Is there any resume() function in python. I need to apply it on my program. need proper explanation… Read more Is Resume() Function Available In Python 2.7?

Django Os.path.dirname(__file__)

I am doing exercises from book: http://www.tangowithdjango.com/book17/chapters/templates_static.ht… Read more Django Os.path.dirname(__file__)

Exception Handling Over Multiple Calling Levels

How do you best handle multiple levels of methods in a call hierarchy that raise exceptions, so tha… Read more Exception Handling Over Multiple Calling Levels

Counting Line Frequencies And Producing Output Files

With a textfile like this: a;b b;a c;d d;c e;a f;g h;b b;f b;f c;g a;b d;f How can one read it, an… Read more Counting Line Frequencies And Producing Output Files

Exclude Day From Pandas Dataframe Date Range

If I want to select a range from the following dataframe I can use this command: bars_specified_day… Read more Exclude Day From Pandas Dataframe Date Range

Django Model Not Updating

I'm trying to count the amount of times a user visits a page: models.py: class Request(models.M… Read more Django Model Not Updating

Opening Folders In Zip Files Python

Is it possible to open a folder located in a zip file and see the names of its contents without unz… Read more Opening Folders In Zip Files Python

How To Use Shared_name On Initializable_iterator

In distributed tensorflow, I need processing input datas on one worker and consuming them on other … Read more How To Use Shared_name On Initializable_iterator

How To Read Merged Cells In Python Using Openpyxl?

I'm trying to read data from the excel file that has merged_cells_range... but the output is no… Read more How To Read Merged Cells In Python Using Openpyxl?

Why Adding Multiple 'nan' In Python Dictionary Giving Multiple Entries?

Example problem: import numpy as np dc = dict() dc[np.float('nan')] = 100 dc[np.float('… Read more Why Adding Multiple 'nan' In Python Dictionary Giving Multiple Entries?

Sine Wave That Exponentialy Changes Between Frequencies F1 And F2 At Given Time/amount Of Samples

I'm trying to implement Python method that generates sine wave, which ramps up between two freq… Read more Sine Wave That Exponentialy Changes Between Frequencies F1 And F2 At Given Time/amount Of Samples

Neural Network Backpropagation Algorithm Not Working In Python

I am writing a neural network in Python, following the example here. It seems that the backpropagat… Read more Neural Network Backpropagation Algorithm Not Working In Python

Removing Lines From A Csv With Python Also Adds An Extra Line

This code, borrowed from another place on stackoverflow, removes all of the places that the csv has… Read more Removing Lines From A Csv With Python Also Adds An Extra Line

How To Make Html Markup Show Up?

so I am new to HTML. I am building a web app with flask. I am trying to visualise some HTML markup,… Read more How To Make Html Markup Show Up?

How Can I Verify My Selfsigned Certificate When Using Easywebdav?

I know how to connect to my owncloud with python, by using easywebdav. I'm using a selfsigned c… Read more How Can I Verify My Selfsigned Certificate When Using Easywebdav?

Sort Numpy Array With Custom Predicate

I'd like to sort my numpy array of shape [n,4], along first dimension (size:n) using a custom p… Read more Sort Numpy Array With Custom Predicate

Missing Dependencies Installing Numpy 1.9 For Python 3.4.1 32-bit On Windows 7

I cannot seem to get NumPy 1.9.0 with Python 3.4.1 32-bit on a Windows 7 AMD 64-bit machine. I down… Read more Missing Dependencies Installing Numpy 1.9 For Python 3.4.1 32-bit On Windows 7

How To Generate Missing Weekids In Python Dataframes

I have a dataset given below with weekids indexed: product_name serial_number date … Read more How To Generate Missing Weekids In Python Dataframes

Autotokenizer.from_pretrained Fails To Load Locally Saved Pretrained Tokenizer (pytorch)

I am new to PyTorch and recently, I have been trying to work with Transformers. I am using pretrain… Read more Autotokenizer.from_pretrained Fails To Load Locally Saved Pretrained Tokenizer (pytorch)

Average Time To Hit A Given Line On 2d Random Walk On A Unit Grid

I am trying to simulate the following problem: Given a 2D random walk (in a lattice grid) starting … Read more Average Time To Hit A Given Line On 2d Random Walk On A Unit Grid

Numba Support For Big Integers?

I have a factorial lookup table that contains the first 30 integer factorials. This table is used i… Read more Numba Support For Big Integers?

Using Ipopt With Openmdao (or Pyoptsparse) In Python

Hello everyone. I have a little problem : I am working with openmdao and pyOptSparseDriver. It is w… Read more Using Ipopt With Openmdao (or Pyoptsparse) In Python

Mysql/python -- Committed Changes Not Appearing In Loop

Using MySQL Connector/Python I have a loop that keeps checking a value for a change every 2 seconds… Read more Mysql/python -- Committed Changes Not Appearing In Loop

The Output Of Re.split In Python Doesn't Make Sense To Me

print (re.split(r'[a-fA-F]','finqwenlaskdjriewasFSDFddsafsafasa',re.I|re.M)) print … Read more The Output Of Re.split In Python Doesn't Make Sense To Me

Python: How To Call The Constructor From Within Member Function

This Question / Answer (Python call constructor in a member function) says it is possible to to cal… Read more Python: How To Call The Constructor From Within Member Function

Twitter Stream Api Gives Jsondecodeerror("expecting Value", S, Err.value) From None

I am using the stream API of Twitter (through tweepy) to collect tweets matching certain criteria, … Read more Twitter Stream Api Gives Jsondecodeerror("expecting Value", S, Err.value) From None

How To Stop Writing A Blank Line At The End Of Csv File - Pandas

When saving the data to csv, data.to_csv('csv_data', sep=',', encoding='utf-8&#… Read more How To Stop Writing A Blank Line At The End Of Csv File - Pandas

Sqlalchemy Attributeerror: 'property' Object Has No Attribute 'translate'

Situation Users make purchases, which are stored as transactions in 3 different tables (depending o… Read more Sqlalchemy Attributeerror: 'property' Object Has No Attribute 'translate'

Turtle Window Exit Errors

When I click out of my turtle window it spits 24 lines of errors to the shell. The error report en… Read more Turtle Window Exit Errors

Pandas Sql Chunksize

This is more of a question on understanding than programming. I am quite new to Pandas and SQL. I a… Read more Pandas Sql Chunksize

Converting List Of String To List Of Integer

How do I convert a space separated integer input into a list of integers? Example input: list1 = li… Read more Converting List Of String To List Of Integer

Using Python To Download An Excel File From Onedrive Results In Corrupt File

I am trying to download an excel file from a OneDrive location. My code works okay to get the file… Read more Using Python To Download An Excel File From Onedrive Results In Corrupt File

Pick Txk Numpy Array From Txn Numpy Array Using Txk Column Index Array

This is an indirect indexing problem. It can be solved with a list comprehension. The question is… Read more Pick Txk Numpy Array From Txn Numpy Array Using Txk Column Index Array