Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed last year. Improve this question I am learning Python, and have a query. Sorry for inconvenience. I have 2 text files as follow…
Tag: python
ValueError: Shape of passed values is (4, 4), indices imply (1, 4)
Can someone explain to me what is the cause of this error? Answer The issue is the index=[‘col1’] argument. The data you’re passing to pd.DataFrame() is a list of 4 lists, where each list has 4 items, so there will be 4 rows and 4 columns. But, you’re setting the index (row labels) to …
How to upload a (csv) file with an AJAX call and Flask
I’m updating on updating an older project that uses AJAX and have decided to use Flask to do so. For the particular page I’m currently working on, I need to be able to upload a CSV and read the data in the file (no need to save it). I have several other pages that work using AJAX, but they return
Add a number in textbox using add_annotations plotly python
How should I set up text in order to get “r-square: 0.90”? Set up: Where: but it is not working. Answer You can use an f-string instead. For example, here is what I get when I use the tips dataset:
Error while reading a JSON file with Python Polars
I am trying to read a GeoJSON with Python Polars, like this: The error I get is: I have also tried to put the same content into a file and I had a similar error. As suggested in GitHub, I tried to read the file via Pandas, like this: The error I get is: What can I do to read
Pandas appending dictionary values with iterrows row values
I have a dict of city names, each having an empty list as a value. I am trying to use df.iterrows() to append corresponding names to each dict key(city): Can somebody explain why the code above appends all possible ‘fullname’ values to each dict’s key instead of appending them to their respe…
How do I create tile-maps in PyGame without download?
I wanted to create tile-maps for my game to take up less space on my computer. I really don’t have much space. I don’t want to download an app to do the job for me, also for the fact that I don’t have much space. How would I go about doing this? Answer There are some tools online and github
How to connect 2 forms in HTML and Django?
I am creating a web page and i’m wondering if i could make sure that the data on the left is filled before pressing the blue button. On the left you can see a form to pay by entering your address, city etc. but on the right you can see another form with stripe implemented to pay with credit card.
Python – Write all tuples of a combination using list comprehension
I would like to create all pairs (i, j) such that i goes from 0 to n-1 and j goes from i to n-1. Basically these are all the unique combinations for two lists of length n. As an example if n=3 then I would like to get It would be great if I could do this with a list
Import pipe delimited txt file into spark dataframe in databricks
I have a data file saved as .txt format which has a header row at the top, and is pipe delimited. I am working in databricks, and am needing to create a spark dataframe of this data, with all columns read in as StringType(), the headers defined by the first row, and the columns separated based on the pipe del…